www.digitalmars.com         C & C++   DMDScript  

c++ - possible lexical error

reply "Wang Phi Phi" <wphiphi brutele.be> writes:
it seems that DMC autorise the use of the dollar sign in
variable/function/... name.

this sample code compile and work fine with DMC8.1C (and not with VC6) :

#include <iostream.h>
void test$function(void)
{
     cout << "hello" << endl;
}

int main()
{
     int test$5a$$ = 10;
     test$function();
     cout << test$5a$$ << endl;
     return 0;
}

output :
hello
10


Wang Phi Phi .
Aug 04 2001
next sibling parent reply "Walter" <walter digitalmars.com> writes:
Yes, it does allow $ as an identifier character. It's a feature, not a bug
<g>. The idea is to be compatible with the popular use of $ in assembler
code identifiers. It is disabled by the -A switch. -Walter

Wang Phi Phi wrote in message <9khu9f$5u8$1 digitaldaemon.com>...
it seems that DMC autorise the use of the dollar sign in
variable/function/... name.

this sample code compile and work fine with DMC8.1C (and not with VC6) :

#include <iostream.h>
void test$function(void)
{
     cout << "hello" << endl;
}

int main()
{
     int test$5a$$ = 10;
     test$function();
     cout << test$5a$$ << endl;
     return 0;
}

output :
hello
10


Wang Phi Phi .
Aug 04 2001
parent "Wang Phi Phi" <wphiphi brutele.be> writes:
Thanks .
Aug 05 2001
prev sibling parent Jan Knepper <jan smartsoft.cc> writes:
 this sample code compile and work fine with DMC8.1C (and not with VC6) :
<g> There are a lot of example that work FINE with DMC++ and won't even compile (or give INTERNAL COMPILER ERROR) with VC--. Just out of precaution... VC-- isn't quite the 'standard' eventhough many users of it would think it is... Jan
Aug 04 2001