lkml.org 
[lkml]   [1999]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: bug in socket.h (and maybe many other kernel headerfiles)
On Fri, 17 Sep 1999, Sean Hunter wrote:

On Fri, Sep 17, 1999 at 11:48:34AM +0200, Dipl.-Ing. Uwe Koloska wrote:
> Hello,
>
> I am not on this list by post by told so in REPORTING-BUGS.
>
> By installing kde-1.1.2 with gcc-2.95.1 I noticed a wrong declaration in
> /usr/incluce/linux/socket.h:109
>
> ANSI C++ forbids implicit conversion from `void *' in return
>
> The right ANSI way to do it is to return a literal "0".
>
> By taking a quick glance on the other headerfiles there are many places that
> uses NULL without explicit conversion.
>
> Maybe (adhearing to ANSI???) NULL has to be defined "0" and not (void*) ...
>

The kernel code is written in C. C requires that NULL be defined as
(void *)0. Returning a NULL as a literal 0 is incorrect in C. There
should not be any kernel headers included in an C++ code. Headers that
could be included are protected with conditional statements like:

#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL (void*)0
#endif
#endif

This was from <stdio.h>......

If this was flame-bait, forget it.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.


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

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:1.601 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site