'cc' versus 'gcc'

Jim Patterson jimp at asterix.UUCP
Thu Sep 28 04:13:38 AEST 1989


In article <506 at shuldig.Huji.Ac.IL> misha%shum.huji.ac.il at CUNYVM.CUNY.EDU writes:
>   I have recently discovered a 'gcc' compiler on our system.
>When I began using it, it appeared that the code runs now much faster
>than the one produced by the standard 'cc'. ...
>I would like to ask whether you have encountered any bugs,

We tried out gcc on our system (Sun 3's), and never encountered what
could be called a 'bug'. (If you have different hardware, this experience
may not relate). We did encounter a few differences between calling
conventions of gcc and those of Sun's compiler. These are relevant
only if you mix the two languages.

The differences that we encountered (there are likely others) are:

- A function declared as returning float actually returns a float
with gcc. cc promotes the float to double. Both are consistent
with the ANSI draft standard. The only time this causes problems
are: if an external reference declares a function float but the
declaration is actually double (works with cc, not with gcc);
or the function is declared float, and the implementation is
compiled with cc but the caller compiles with gcc.

- Struct alignments. gcc will allocate a struct containing a single
byte (or 8 bits or less of bit-fields) to be 1 byte long. cc allocates
a minimum of 2 bytes for any struct.

-- 
Jim Patterson                              Cognos Incorporated
UUCP:decvax!utzoo!dciem!nrcaer!cognos!jimp P.O. BOX 9707    
PHONE:(613)738-1440                        3755 Riverside Drive
                                           Ottawa, Ont  K1G 3Z4



More information about the Comp.unix.questions mailing list