[lkml]   [2005]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: Illegal use of reserved word in system.h
Hello all,

Sorry about the automatic disclaimer at the bottom of these emails, it's

part of working here at Dolby. I'm sure it doesn't apply to this


I had a few responses to this bug fix request (which I did mail to this

list), none were what I was hoping for, namely "This will be fixed in

the next release", so allow me to clarify.

The problem: Linux kernel headers use C++ reserved words as variable

names. This breaks builds of C++ code that include kernel headers.

Examples: The use of "new" in the macro __cmpxchg in system.h. This hits

MySQL which links into the kernel headers to determine if the platform

is SMP aware or not (don't ask me why.)

The use of "virtual" in the structure drm_buf_map in drm.h, used

by drm_bufs.c. This hits C++ code that uses the DRI interface to lock

with vertical retrace.

The solution: rename these variables, keep C++ reserved words out of

headers, make this practice part of the style guide.

I'm not advocating writing parts of the kernel in C++, or cleaning out

reserved words in the entire kernel. I know the one and only true

language is C, but for Linux to achieve world domination it needs to be

inclusive at running (and building) any software in whatever language.

As to the comments stating that "Userspace code shouldn't include kernel

headers", that's fine in the "Hello, World", but in the real world,

applications need access to devices and system resources, which means

communicating with the kernel with the proper ioctls, flags, system

configuration, data structures, etc., which are kept in kernel headers.

For this reason, breaking these apart from the application build

environment is a really bad idea, no mater what Linus Torvalds has to

say about it (see It needs to

be an fully integrated system for everything to run correctly.

Besides, I don't have time to rewrite MySQL in C to make it "correct".

I've got more important things to do. ;^)

So please, keep your headers clean.

John Gilbert

Ignore the sig.



This message (including any attachments) may contain confidential

information intended for a specific individual and purpose. If you are not

the intended recipient, delete this message. If you are not the intended

recipient, disclosing, copying, distributing, or taking any action based on

this message is strictly prohibited.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-05-18 20:35    [W:0.130 / U:0.120 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site