C++ and variables

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

C++ and variables

Post 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 ;)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$ is not a valid identifier character in C
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

i.e. forget $ ever existed when working in C/C++. It has nothing to do with anything. ;)
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

yeah, $var would look weird in C++ ;)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

It does work, but most compilers by default won't accept it. It's usually used for machine generated code.
Post Reply