Douglas Walls' Weblog

« Previous day (Feb 11, 2006) | Main | Next day (Feb 13, 2006) »
20060212 Sunday February 12, 2006

c89 command on linux

Suns's compilers have previewed on linux, take a look here http://developers.sun.com/prodtech/cc/linux_index.html.

This is just a preview, we have a long way to go before we can or will make this a product offering. On the way to doing that we got some feed back on the SDN, that our c89 command should work like the c89 command encountered on Linux.

Specifically, the following simple test case gets an error using the c89 command from Sun:

long long foo;

But the c89 command on linux accepts this declaration.

Why does the c89 (/bin/c89) command on linux allow this? It makes no sense at all, the entire purpose of the c89 command is to provide a portable compilation environment to those conforming to SUSv3. SUSv3 support the 1994 ISO C standard. long long is not an allowed type in the ISO 1994 C standard.

Sun is porting it's compiler from Solaris it Linux. On Solaris, Sun supports SUSv2 which defines the c89 command. We implement the c89 command by being pedantic about the 1994 C ISO language as required by SUSv2, and thus long long must not be accepted as a legal type. There are conformance tests that check this, and you cannot pass them without producing an error message.

We can change the error message into a warning and thus pass the conformance test and still present a consistent interface across Solaris and Linux.

But what we do not yet understand, is why /bin/c89 on linux does not produce even a warning message for the above program ...

( Feb 12 2006, 08:01:22 PM PST ) Permalink Comments [2]

Search

Calendar

Links

Navigation

Referers