comp.lang.ada
 help / color / mirror / Atom feed
From: jscheibl@mason2.gmu.edu (Jack W Scheible)
Subject: Re: Limitations of Ada
Date: 1996/08/05
Date: 1996-08-05T00:00:00+00:00	[thread overview]
Message-ID: <4u50g1$li1@portal.gmu.edu> (raw)
In-Reply-To: DvJyKB.9DC@thomsoft.com


In article <DvJyKB.9DC@thomsoft.com> 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




  reply	other threads:[~1996-08-05  0:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-29  0:00 Limitations of Ada Marin David Condic, 407.796.8997, M/S 731-93
1996-07-30  0:00 ` Kazimir Majorinc
1996-07-30  0:00   ` Robert Dewar
1996-07-30  0:00   ` Brian Rogoff
1996-07-31  0:00   ` Robert A Duff
1996-07-31  0:00   ` Fraser Wilson
1996-07-31  0:00   ` Brian Rogoff
1996-08-01  0:00   ` Spasmo
1996-08-08  0:00     ` mpost
1996-08-01  0:00   ` Bob Kitzberger
1996-08-02  0:00     ` Jack W Scheible
1996-08-02  0:00       ` Robert Dewar
1996-08-03  0:00       ` Keith Thompson
1996-08-05  0:00         ` Jack W Scheible [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-07-19  0:00 The Quelisher
1996-07-20  0:00 ` Michael Feldman
1996-07-21  0:00 ` Nasser Abbasi
1996-07-23  0:00   ` Bob Munck
1996-07-24  0:00     ` David Kristola
1996-07-24  0:00       ` Ron Thompson
1996-07-26  0:00         ` Ken Garlington
1996-07-29  0:00           ` Byron B. Kauffman
1996-07-25  0:00     ` Keith Thompson
1996-07-29  0:00     ` David Weller
1996-07-22  0:00 ` Klaus Wyss
1996-07-23  0:00   ` Robert Dewar
1996-07-24  0:00     ` David Emery
1996-07-30  0:00 ` Theodore E. Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox