On Wed, 31 Jan 2001, Daniel A. Koepke wrote:
>On Tue, 30 Jan 2001, Peter Ajamian wrote:
>
>> When 0 is casted as a pointer it must be converted to NULL
>
>No. He meant NULL *is* 0. Conversion from 0 to NULL is meaningless.
>NULL *is* 0.
That's exactly what I meant. The only reason we write:
#define NULL (void *)0
in utils.h (and most other programs) is because then we at least get
integer/pointer conversion warnings from the compiler.
>> Now if you're quite sure that the program your working on will never
>> be compiled on a platform that uses a value other than all-bits-zero
>> [...]
>
>And you can be quite sure of that. Because it's true in 99% of the cases
>and the 1% probably aren't supported, anyway.
GCC itself uses the all-bits-zero assumption in its code. It's so much
easier to just have memset() on the structure instead of manually caring
which field is a pointer or not.
--
George Greer
greerga@circlemud.org
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/03/01 PST