www.digitalmars.com         C & C++   DMDScript  

D - $ in identifier names

reply Paul Matthews <plm pcug.org.au> writes:
G'Day,

gcc and old c compilers used to allow $ in identifiers. Personally, I
find this handy as you cannot get a name clash. 

The background is that I have programs that generate other programs
(compile and then run them in the background) from input the users have
given.

For example is a user requests "restrict '$date<20010101'", the program
might generate:

	while( getrecord(in,record) )
	{
	const string $cust = record[0];
	const string $date = record[1];
	:
	if( numeric($date)<20010101 )
		putrecord(out,record);
	}

Just a thought!

--
Paul Mathews
Nov 30 2001
parent "Walter" <walter digitalmars.com> writes:
I've been leaving that option open by avoiding using $ or   as operator
tokens. -Walter

"Paul Matthews" <plm pcug.org.au> wrote in message
news:3C074DFD.3645FE86 pcug.org.au...
 G'Day,

 gcc and old c compilers used to allow $ in identifiers. Personally, I
 find this handy as you cannot get a name clash.

 The background is that I have programs that generate other programs
 (compile and then run them in the background) from input the users have
 given.

 For example is a user requests "restrict '$date<20010101'", the program
 might generate:

 while( getrecord(in,record) )
 {
 const string $cust = record[0];
 const string $date = record[1];
 :
 if( numeric($date)<20010101 )
 putrecord(out,record);
 }

 Just a thought!

 --
 Paul Mathews
Nov 30 2001