Go Down

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

WanaGo

Hello

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?

Thanks

PaulS

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.

WanaGo

Thanks
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.

Thanks

sciguy

Quote
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