Documenting tools necessary for GCC [draft]

Fergus Henderson fjh@cs.mu.OZ.AU
Sun Jun 1 13:34:00 GMT 2003


On 01-Jun-2003, Robert Dewar <dewar@gnat.com> wrote:
> > The C standard gives an implementor far less wiggle room.
> 
> Basically the C standard was written to enable the writing of portable
> code, and required C compilers to conform to a common functional spec
> for a large part of the language.
> 
> The Posix spec is not written with this in mind,

The name POSIX (_Portable_ Operating System Interface)
certainly suggests otherwise.

I understand that the Posix spec aimed to standardize the common features
of existing Unix implementations, which had been diverging for quite
some time.  But this is not so different from the development of the
C standard.

> there are huge and significant unspecified functionalities

The same is true of C.

> (for example, POSIX threads
> does not even bother to precisely define the dispatching model).

So Posix doesn't define the order of evaluation of code in different threads?
C doesn't define the order of evaluation of arguments to function calls.
In addition, almost any use of signal() results in undefined behaviour,
and some argue that the same is true of "volatile".  There are many
other examples.

> you are definitely not guaranteed that
> your posix code from another system will port unchanged. 

Neither are you guaranteed that your C code from another system will
port unchanged.

> Yes, you can carefully write to the common guaranteed subset, but this
> is not particularly the intention of the standard, and is in practice
> very difficult to do.

Writing portable C code is very difficult too... and yet people manage it.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the Gcc mailing list