Re: bug in socket.h (and maybe many other kernel headerfiles)

Sean Hunter (sean@uncarved.co.uk)
Sat, 18 Sep 1999 07:54:44 +0100


On Fri, Sep 17, 1999 at 02:14:44PM -0400, Benjamin LaHaise wrote:
> On Fri, 17 Sep 1999, Sean Hunter wrote:
>
> > Why are you compiling kernel headers with a c++ compiler? The kernel
> > headers don't work in c++.
>
> There still exist libc5 systems that are running 2.2 kernels and egcs/gcc
> 2.95.

That is true, but read my statement. The kernel headers don't work
with g++. That is because they are not c++, they are c. Ansi
standard C++ lost its direct compatibility with c in several places
including operator precedence. g++ also parses statements somewhat
differently so that this

switch(x) {
case 'a': do_something(); break;
case 'b':
case 'c': do_something_else(); break;
case 'd':
}

...will compile in gcc but not g++ IIRC. Now strictly in ansi c the
above should not be allowed as a statement label (which "case 'd':"
is) has to attach to a statement (which there isn't one in this case).

This is why (regardless of libc), the kernel headers should not be
compiled by a c++ compiler.

Sean

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/