Ok so im still learning C++, looking at some directx and i come across a _ before a var and was wondering what it means.

for example:
pDevice->SetVertexDeclaration( _vertexDeclaration );

or in a error macro:
SHOWERROR( “CreateVertexBuffer failed.”, __FILE__, __LINE__ );

first one is probably the best example.
thanks.

1. It's absolutely clear and ordinar member function call via a pointer to the object (with single argument).
2. Again it's not a syntax related question, syntactically it's a very simple construct. There are two standard macros in C and C++:
__FILE__ - expands to the current source module name (as a string literal)
__LINE__ - expands in the current source module line number (as a decimal constant).
Of course, you must have a minimal knowledge of C++ language to read sources ;)

Ok so i didnt know that the __FILE__ and __LINE__ were standard C/C++ macros, so that was helpful thanks.

I thought there may be some significance in having an underscore prefix on a variable, be it syntatical or naming convention but obviously not.

17.6.4.3.3 Global names [global.names]
1 Certain sets of names and function signatures are always reserved to the implementation:
— Each name that contains a double underscore _ _ or begins with an underscore followed by an uppercase
letter (2.11) is reserved to the implementation for any use.
— Each name that begins with an underscore is reserved to the implementation for use as a name in the
global namespace.176

What you should avoid doing though is using leading underscores in your own code.

This article has been dead for over six months. Start a new discussion instead.