Messages in this thread Patch in this message | | | From | "Khimenko Victor" <> | Date | Thu, 30 Apr 1998 02:18:51 +0400 (MSD) | Subject | Re: socket.h patch -- right way |
| |
29-Apr-98 13:21 you wrote: > > 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 be AUTOMATICALLY casted to ANY pointer. This is true for ANSI C++ standard and 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)?:
--- include/linux/fs.h Tue Apr 21 03:02:37 1998 +++ include/linux/fs.h Thu Apr 30 02:28:27 1998 @@ -61,7 +61,11 @@ #define WRITEA 3 /* write-ahead - don't block if no resources */ #ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else #define NULL ((void *) 0) +#endif #endif #define NIL_FILP ((struct file *)0) --- include/linux/posix_types.h Tue Dec 9 11:07:19 1997 +++ include/linux/posix_types.h Thu Apr 30 02:31:02 1998 @@ -8,7 +8,11 @@ */ #ifndef NULL +#ifdef __cplusplus +# define NULL 0 +#else # define NULL ((void *) 0) +#endif #endif /* --- include/linux/sched.h Tue Apr 21 03:02:38 1998 +++ include/linux/sched.h Thu Apr 30 02:28:14 1998 @@ -99,7 +99,11 @@ }; #ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else #define NULL ((void *) 0) +#endif #endif #ifdef __KERNEL__ --- include/linux/stddef.h Sat Nov 23 13:29:04 1996 +++ include/linux/stddef.h Thu Apr 30 02:29:44 1998 @@ -2,7 +2,11 @@ #define _LINUX_STDDEF_H #undef NULL +#ifdef __cplusplus +#define NULL 0 +#else #define NULL ((void *)0) +#endif #undef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) --- include/linux/string.h Sat Apr 4 06:05:41 1998 +++ include/linux/string.h Thu Apr 30 02:29:03 1998 @@ -4,7 +4,11 @@ #include <linux/types.h> /* for size_t */ #ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else #define NULL ((void *) 0) +#endif #endif #ifdef __cplusplus
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |