From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,96ed71365ee11846 X-Google-Attributes: gid103376,public From: jscheibl@mason2.gmu.edu (Jack W Scheible) Subject: Re: Limitations of Ada Date: 1996/08/05 Message-ID: <4u50g1$li1@portal.gmu.edu>#1/1 X-Deja-AN: 172252918 references: <4tr86p$fvd@rational.rational.com> <4tsvs7$ctk@portal.gmu.edu> content-type: text/plain; charset=US-ASCII organization: George Mason University, Fairfax, Virginia, USA mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-08-05T00:00:00+00:00 List-Id: In article kst@thomsoft.com (Keith Thompson) writes: >In <4tsvs7$ctk@portal.gmu.edu> jscheibl@mason2.gmu.edu (Jack W Scheible) writes: >> There is no reason at all that the C pre-processor cannot be >> run on Ada source before sending it to the compiler. Therefore, >> one _can_ use macros, but it is neither standard nor advisable - >> macros can be a source of very hard-to-find bugs. > >Actually, there is a reason. The C preprocessor chokes on some Ada >constructs. The ISO C standard requires the input to the preprocessing >phase to be a valid token stream. I don't remember the exact details, >but one consequence is that an apostrophe that's not part of a character >literal (e.g., in an Ada attribute) is illegal. > >Here's an example: > >package Foo is >#ifdef FIRST > X : Integer := Integer'First; >#else > X : Integer := Integer'Last; >#endif >end Foo; > >The "cc -E" command under Solaris complains: > >"foo.ads", line 5: invalid input token: 'Last; > The above code works just fine with the command "cpp -P" under Solaris. It is _still_ a bad idea. -jack