www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

D - $ in identifier names

↑ ↓ ← 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
↑ ↓ → "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