lkml.org 
[lkml]   [1998]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: socket.h patch -- right way

>> A struct cmsghdr * is returned, so we shouldn't return (void*)NULL but
>> (struct cmsghdr*) NULL . This only matter in C++, I guess.

> This is not matter even for C++ :-)) Since NULL is 0 in C++ and 0 in C++ could

Hm, not exactly :) NULL (or the null pointer constant) doesn't have to be
0 in C++ (or C?) -this is implementation dependant- even if you are
guarranteed that 0 can be casted to a null pointer (and that the null
pointer can be casted to any pointer)

> be AUTOMATICALLY casted to ANY pointer. This is true for ANSI C++ standard and

You are right, however the problem here isn't casting to null. Or at least
I didn't intend to mean it was.

> for gcc/pgcc/egcs... Unfortunatelly sched.h define NULL as ((void *) 0)
> even in C++ :-(( May be better use the following patch (since NULL
> defined as ((void *) 0) will not good for C++ anyway)?:

But why don't you want to use return (struct cmsghdr*) NULL? This has the
advantage that it's valid with NULL being 0 or ((void*) 0) since conversion
is explicit. Or am I missing something? :)

____/| Ragnar Hojland (ragnar@lightside.ddns.org) Fingerprint 94C4B
\ o.O| 2F0D27DE025BE2302C
=(_)= "Thou shalt not follow the NULL pointer for 104B78C56 B72F0822
U chaos and madness await thee at its end." hkp://keys.pgp.com



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:42    [W:0.646 / U:0.100 seconds]
©2003-2011 Jasper Spaans. Advertise on this site