quick synax question

Reply

Join Date: Sep 2008
Posts: 30
Reputation: Richy321 is an unknown quantity at this point 
Solved Threads: 0
Richy321 Richy321 is offline Offline
Light Poster

quick synax question

 
0
  #1
Jan 2nd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: quick synax question

 
0
  #2
Jan 2nd, 2009
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
Last edited by ArkM; Jan 2nd, 2009 at 7:43 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 30
Reputation: Richy321 is an unknown quantity at this point 
Solved Threads: 0
Richy321 Richy321 is offline Offline
Light Poster

Re: quick synax question

 
0
  #3
Jan 2nd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,851
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: quick synax question

 
0
  #4
Jan 2nd, 2009
Originally Posted by c0x draft
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC