klash@hobbes.UUCP (Karl Klashinsky) (05/16/89)
Thanks for reading this far. WHAT: I am curious about the existence of ANSI standard-conforming compilers. Are there any out there yet? Are they commercial? Is there a GNU ANSI C compiler? WHY: We are having a small war (read: debate) on whether we should develop in C or in our own proprietary language. Opponents of C argue that C does not provide proper type-checking of function arguments. I'm arguing that ANSI C would give us this, and more (portability is important), but I need to be able to wave an ANSI C compiler in their face and say "See! It really does exist!" On a related note, can anybody tell me if there is going to be some kind of symbol defined so that I can 'ifdef' code for an ANSI compiler? For eg, I would like to be able to do something like this: #ifdef ANSI extern void foo ( int, char * ); #else extern void foo (); #endif Thanks, Karl Klashinsky "I shall endeavour to Bell-Northern Research, Ltd. function adequately." utgpu!bnr-vpa!bnr-fos!hobbes!klash Lt. Data
gwyn@smoke.BRL.MIL (Doug Gwyn) (05/17/89)
In article <503@bnr-fos.UUCP> klash@hobbes.UUCP (Karl Klashinsky) writes: >I am curious about the existence of ANSI standard-conforming compilers. >Are there any out there yet? Are they commercial? >Is there a GNU ANSI C compiler? (Ignoring the fact that there isn't actually an ANSI standard quite yet.) Several commercially available compilers claim to be standard-conforming or at least "ANSI C compatible" (which seems to mean that they support function prototypes, at least). AT&T has promised to release one with UNIX System V Release 4.0. GCC seems to be fairly highly conforming from what I have heard (for 100% conformance one supposedly has to specify a couple of command-line options to override default behavior). Certainly most major C compiler vendors have expressed their intentions to provide standard-conforming implementations as soon as possible. >On a related note, can anybody tell me if there is going to be some >kind of symbol defined so that I can 'ifdef' code for an ANSI compiler? It's supposed to be __STDC__, but some vendors have already started to define this as a variety of things for non standard-conforming implementations. We argued about this issue on comp.std.c not long ago. __STDC__ is guaranteed to be predefined as 1 in a standard conforming implementation. Unfortunately you can't tell if it's undefined, defined as 0, or defined as > 1 (which is supposed to be reserved for future C standards) in a nonconforming implementation. I think it has even been defined as 1 in one blatantly nonconforming case. I suggest you invent your own configuration macro, defined in your system-configuration application standard header file (mine is called "std.h") which you should have anyway if you're trying for portability. For example, mine is defined as follows by default but can be edited to hard-code the correct value in case a really bogus implementation is encountered: /* Defense against some silly systems defining __STDC__ to random things. */ #ifdef STD_C #undef STD_C #endif #ifdef __STDC__ #if __STDC__ > 0 /* present and future Standard C */ #define STD_C __STDC__ /* use this instead of __STDC__ */ #endif #endif Then I use STD_C where one really ought to have been able to use __STDC__.
ark@alice.UUCP (Andrew Koenig) (05/17/89)
In article <503@bnr-fos.UUCP>, klash@hobbes.UUCP (Karl Klashinsky) writes: > We are having a small war (read: debate) on whether we should > develop in C or in our own proprietary language. Opponents of > C argue that C does not provide proper type-checking of function > arguments. I'm arguing that ANSI C would give us this, and more > (portability is important), but I need to be able to wave an > ANSI C compiler in their face and say "See! It really does > exist!" How about C++? It's portable, provides tighter type-checking than ANSI compilers, and it's available now. -- --Andrew Koenig ark@europa.att.com
giguere@aries5.uucp (Eric Giguere) (05/17/89)
In article <503@bnr-fos.UUCP> klash@hobbes.UUCP (Karl Klashinsky) writes: >I am curious about the existence of ANSI standard-conforming compilers. >Are there any out there yet? Are they commercial? >Is there a GNU ANSI C compiler? You didn't mention for which machine, though I suppose we can assume it's Unix-based since no other compilers are really discussed here.... Anyhow, the Proposed ANSI Standard has yet to become the official ANSI Standard but that's supposed to come soon... technically though, there are NO ANSI-conformant compilers. Most compiler vendors have been upgrading their wares to implement at least the major additions that the Standard brings to the language. There have been articles in various magazines testing compilers for "ANSIness", see Computer Language about 5 or 6 months ago for one. As for those implementations, here's a list of those I know: IBM PCs -- Watcom C and Microsoft C. C on a PC requires a few language additions to properly handle the oddities of the 8XX86 architecture. Amigas -- Lattice C 5.0 is fairly ANSI, Manx C is coming out with an ANSIized version this summer. Unix -- GNU C supports most ANSI features (haven't tried the nitty gritty stuff). IBM VM/CMS & MVS -- Waterloo C supports most of the ANSI features. While a few vendors have gone and implemented the whole draft Standard (Watcom C is an example) most have taken a "wait-and-see" attitude towards the small stuff and only implemented major things like prototyping. It'll take a few years before everyone settles down. Even then some of us will probably be saddled with "cc" on some hair-brained Unix system... Eric Giguere 268 Phillip St #CL-46 For the curious: it's French ("jee-gair") Waterloo, Ontario N2L 6G9 Bitnet : GIGUERE at WATCSG (519) 746-6565 Internet: giguere@aries5.UWaterloo.ca "Nothing but urges from HELL!!"
dan@oresoft.uu.net (Daniel Elbaum) (05/18/89)
Oregon Software sells a C compiler for Unix machines which, according to command-line switches, acts as a dpANS C, K&R C, or C++ compiler. Along with __STDC__, the compiler supports preprocessor identifiers _COMPATIBILITY_, for K&R, and _CPLUSPLUS_ and _cplusplus_ for C++. These days it's hard to swing a dead cat without hitting a compiler which at least claims partial pANSI compliance. CLAIMER: I work for Oregon Software. -- The workaday world must remain transparent to those who maintain it if they are to find inspired within them a vision of the history they create. ({uunet,tektronix,reed,sun!nosun,osu-cis,psu-cs}!oresoft!(dan)@oresoft.uu.net)
gwyn@smoke.BRL.MIL (Doug Gwyn) (05/18/89)
In article <198@maytag.waterloo.edu> giguere@aries5.waterloo.edu (Eric Giguere) writes: >technically though, there are NO ANSI-conformant compilers. There are sure a lot of C compilers that attempt to be ANSI conforming, most of them currently in Beta test. Remember that there is a delay between initial development of a product and its commercial availability. Some compiler implementors have told me that they would wait until a year after a feature appeared in the draft Standard before implementing it, to allow time for problems to have surfaced and been solved. There were at least minor changes right up to the December 1988 draft, so you can count forward from that date to estimate when you might be able to obtain a compiler that attempts to be fully ANSI conforming. Validation of compilers that claim Standard conformance is another issue. I think there are efforts underway, and there certainly are test suites, but I don't have accurate current information about compiler validation. Validation is an issue because it would be the simplest way to demonstrate compliance with procurement specifications that require Standard conformance.
giguere@aries5.uucp (Eric Giguere) (05/18/89)
In article <10281@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >In article <198@maytag.waterloo.edu> giguere@aries5.waterloo.edu (Eric Giguere) writes: >>technically though, there are NO ANSI-conformant compilers. > >There are sure a lot of C compilers that attempt to be ANSI conforming, >most of them currently in Beta test. Remember that there is a delay >between initial development of a product and its commercial availability. The point I was making here was that NO ANSI Standard yet exists, hence no ANSI-conformant compiler can exist. The Standard is still in the Proposed state, though very close (finally) to being approved and made an official ANSI Standard.... whether the ISO will approve it is another matter but I think ANSI is all most of the North American implementors really care about anyhow... >Validation of compilers that claim Standard conformance is another issue. >I think there are efforts underway, and there certainly are test suites, >but I don't have accurate current information about compiler validation. >Validation is an issue because it would be the simplest way to demonstrate >compliance with procurement specifications that require Standard conformance. There are definitely some validation suites out there... I've had experience with the Plum Hall suite. The suites are quite expensive to license and must constantly be updated because the Drafts have been changing (and bugs keep being found in the suites). I haven't heard that ANSI will be adopting any suite for use in certification tests, but I know the British are looking at using one suite for official validation. As I see it the real headache in the next few years will be getting people to convert to ANSI-style compilers. I cringe whenever I'm forced to use `cc'... I miss the prototypes and the new-style declarations. I think it's a good idea to encourage people to use any conversion tools available to convert old C into new C... as long as the new C code doesn't break, of course. Eric Giguere 268 Phillip St #CL-46 For the curious: it's French ("jee-gair") Waterloo, Ontario N2L 6G9 Bitnet : GIGUERE at WATCSG (519) 746-6565 Internet: giguere@aries5.UWaterloo.ca "Nothing but urges from HELL!!"