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: kst@thomsoft.com (Keith Thompson) Subject: Re: Limitations of Ada Date: 1996/08/03 Message-ID: #1/1 X-Deja-AN: 171878392 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar references: <96072915521064@psavax.pwfl.com> <4tlpfa$cr9@bagan.srce.hr> <4tr86p$fvd@rational.rational.com> <4tsvs7$ctk@portal.gmu.edu> organization: Thomson Software Products, San Diego, CA, USA newsgroups: comp.lang.ada originator: kst@pulsar Date: 1996-08-03T00:00:00+00:00 List-Id: 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