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

From: Tigran Aivazian (tigran@veritas.com)
Date: Thu Apr 27 2000 - 10:11:41 EST


On Thu, 27 Apr 2000, Paul Barton-Davis wrote:
> >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).

hey, I am sure Jes was joking, just forgot to put a smiley there :)

Of course, one can include anything he likes anywhere he likes - but to
prevent compilation failures the headers protect some stuff with
__KERNEL__ and if the program *really* wants to access that stuff (e.g.
some readers of /dev/kmem etc.) they can define __KERNEL__ and then deal
with the problems internally, i.e. it becomes app programmer's problem to
arrange the headers correctly and not a kernel header writer's problem.

The problem of dealing optimally with all possible paths that lead to a
given header is too complex to worry in this generation so one shortcuts
this using #define and #ifndef..

Regards,
Tigran

-
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