Page 1 of 1

C++ and variables

Posted: Sat Oct 01, 2005 3:49 pm
by MarK (CZ)
Hi,

I started learning C++ some time ago and now - since I'm addicted to PHP :twisted: - I wonder whether it's okay to use dollar sign ('$') as a perfix for variables. It seems to work but I'd like to know whether it is an acceptable practice..?

Thanks in advance ;)

Posted: Sat Oct 01, 2005 4:07 pm
by feyd
$ is not a valid identifier character in C

Posted: Wed Oct 05, 2005 12:30 pm
by Skara
i.e. forget $ ever existed when working in C/C++. It has nothing to do with anything. ;)

Posted: Wed Oct 05, 2005 12:54 pm
by Ree
yeah, $var would look weird in C++ ;)

Posted: Wed Oct 05, 2005 3:42 pm
by Ambush Commander
It does work, but most compilers by default won't accept it. It's usually used for machine generated code.