Go Down

Topic: _ or __ in front of variables (Read 3025 times) previous topic - next topic



Newbie question here - but I have noticed on a few peoples example programs, the use of _ or __ in front of some variables. I was just wondering what the purpose of these underscores is?

Do they serve a purpose, or are they just so the variables stand out or something?



Typically, the underscore is used in front of member variables in a class, to distinguish them (for the reader) from local variables. The presence or absence of the _ (or __) makes no difference to the compiler.


So by 'member variables' you mean what I would call 'Global Variables' ?

As in variables that can be used throughout the sketch rather than local ones to a function.

Sorry coming from IEC PLC programming to this and still learning.

Since they have no effect to the compiler, that is good to know.



So by 'member variables' you mean what I would call 'Global Variables' ?

No, not at all, sorry.

What he means is variables that are part of a class.  
Not global, not local in a function, but in a separate class.
Soundcloud page: http://soundcloud.com/beefinator-2
Youtube channel: http://www.youtube.com/user/beefinator14
Old soundcloud page (ran out o

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131