Mail Archives: djgpp-workers/2004/02/03/09:46:59
> Strict ANSI C may say so, but GNU C has sizeof(void) == 1 (and therefore
> arithmetic on void pointers works just like on char pointers). Is there
> any reason not to use GNU extensions in the library sources?
I'd rather avoid extensions when there are ways of doing it portably,
assuming that it doesn't make the code a lot harder to read. You
never know when GCC will become more strict (like always warning) and
we'd have a mess to clean up.
> > I'm also not a big fan of "NULL" in general, but it's OK in this case.
> > In general, NULL is *not* the same as a literal zero.
>
> Yes, but I thought that the difference was a reason _not_ to use literal
> zero when it would be implicitly cast to a pointer.
A literal zero can always be cast to any pointer. NULL cannot always
be cast to other types of zeros. I've seen compilers that defined
NULL to a specific types of pointer, which caused numerous errors.
Like I said, it's OK for us in DJGPP (becuase I know DJGPP defines it
to be a literal zero anyway) but in general I don't like NULL. There
was also a time when g++ defined NULL to __null and got it wrong for
djgpp, causing lots of problems.
- Raw text -