Article View: comp.sys.sequent
Article #131Re: '$' in Sequent C Compiler
From: Dorsey Drane
Date: Thu, 14 Sep 1989 16:09
Date: Thu, 14 Sep 1989 16:09
46 lines
2792 bytes
2792 bytes
In article <1355@syma.sussex.ac.uk> andrewn@syma.UUCP (Andrew D Nimmo) writes: > > On compiling a C program on our Symmetry, the compiler > complained that '$' was an illegal character. Compilers on other > machines have never given me this problem - is it a bug or do we have to > live with it? >-- > Andrew D. Nimmo, VLSI and Graphics Research Group, > EAPS II, University of Sussex, Falmer, BRIGHTON, East Sussex, BN1 9Qt > TEL: +44 273 606755 x 2617 > EMAIL: (JANET) andrewn@syma.sussex.ac.uk | (UUCP) ...mcsun!ukc!syma!andrewn It's not a bug - it's due to Sequent's C compiler being derived from AT&T's C compiler, which does not accept '$' as a valid character in an identifier. Sequent is trying to be compatible with AT&T, so we have no plans to change this in the near future. (It's invalid in ANSI C too.) My guess is that C compilers that do accept '$' in identifiers have been so extended because they had a need to interface C routines with routines written on other languages. E.g., DEC's VAX systems make heavy use of $ in system routines, and I can see that they would find such an extension handy. If you have such a need, you might do what I did when I needed a C function that had a '%' in its name: I compiled the C function with -SO, which gave me the assembly language output on stdout, and piped that through sed which changed the name to what I wanted, and then piped that into the assembler. cc -SO -O func.c | sed /func_name/s//%&/ | as -o func.o This put my '%' as the leading char of the name, where I needed it. You could do the same with a '$'. (Of course a '$' can't be the leading char in an identifier as a leading '$' has a different meaning to the assembler.) This kludge will let you change a valid C name to the required name. Finally, if you really need this enhancement, please file a mailbug specifying that it's important to you to be able to compile such identifiers. It could be that there's a growing source of C code coming from non-Unix systems that have this need, and Sequent should provide the ability. (If we do so, I'm sure we'd enable the feature only when specified by some new command-line option.) Good luck, - Dorsey
Technical Details
Message-ID:
<21660@sequent.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!zephyr.ens.tek.com!tektronix!sequent!draneReferences:
<1355@syma.sussex.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!zephyr.ens.tek.com!tektronix!sequent!drane From: drane@sequent.UUCP (Dorsey Drane) Newsgroups: comp.sys.sequent Subject: Re: '$' in Sequent C Compiler Summary: '$' is non-standard in Unix C compilers Keywords: C compiler dollar identifiers Message-ID: <21660@sequent.UUCP> Date: 14 Sep 89 16:09:59 GMT References: <1355@syma.sussex.ac.uk> Reply-To: sequent!drane (Dorsey Drane) Organization: Sequent Computer Systems, Inc Lines: 46