From: kst@thomsoft.com (Keith Thompson)
Subject: Re: Limitations of Ada
Date: 1996/08/03
Date: 1996-08-03T00:00:00+00:00 [thread overview]
Message-ID: <DvJyKB.9DC@thomsoft.com> (raw)
In-Reply-To: 4tsvs7$ctk@portal.gmu.edu
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;
Of course, there's nothing in the ISO C standard that requires the
preprocessor to exist as a separate program, or "cc -E" to behave in any
particular fashion. Similarly, there's nothing preventing someone from
implementing a C-like preprocessor with fewer restrictions. However,
using the C preprocessor on Ada code is likely to cause problems, as
the example above shows.
--
Keith Thompson (The_Other_Keith) kst@thomsoft.com <*>
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
"As the most participatory form of mass speech yet developed, the Internet
deserves the highest protection from government intrusion." -- ACLU v. Reno
next prev parent reply other threads:[~1996-08-03 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 ` Brian Rogoff
1996-07-31 0:00 ` Fraser Wilson
1996-07-31 0:00 ` Robert A Duff
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 [this message]
1996-08-05 0:00 ` Jack W Scheible
1996-08-01 0:00 ` Spasmo
1996-08-08 0:00 ` mpost
-- 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