Re: [PATCH] C++ breaks on linux/ioport.h

From: Paul Barton-Davis (pbd@Op.Net)
Date: Thu Apr 27 2000 - 09:48:44 EST


Two responses to a report of a problem with the use of the C++ keyword
"new" in a header file:

>From: Alexander Viro <viro@math.psu.edu>

>>
>> This include didn't work under C++...
>
>Erm... Looks like the whole file needs #ifdef __KERNEL__ around it anyway,
>so I'ld rather add it and be done with the thing. Guts of the kernel
>includes are not supposed to work in userland...

>From: Jes Sorensen <Jes.Sorensen@cern.ch>

>Thats pretty irrelevant, you are not supposed to include the kernel
>headers in C++ programs.

I find this approach pretty worrying. Its *often* necessary to include
such files in user-space programs that use ioctl to control various
hardware resourcs (e.g. linux/rtc.h).

I really hope that we don't have the attitude that these programs
CANNOT be C++. All it takes to ensure header-file compatibility is
avoidance of a few extra C++ keywords (such as "new"). I don't think
anyone is asking for anything else.

If the suggestion is that *no* true kernel header should ever be
included, but that glibc should come with its own versions of them all:
how can this cover h/w-specific resource like the RTC etc. ?

--p

-
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/



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:13 EST