"do ... while ((NULL + 1) - 1);" -- valid C?

DAVID NEWALL ccdn at levels.sait.edu.au
Fri Aug 18 01:15:36 AEST 1989


A while ago, ccdn at levels.sait.edu.au (That's me!) wrote:
>                 do
>                    ...
>                 while ((s = strchr(s, ',') + 1) - 1);
>
> I've been told that this is not valid C

Thanks, everyone, for your opinions.  I'll remember the rule in future:
(Offsets to NULL are non-portable, and should never be used).


David Newall                     Phone:  +61 8 343 3160
Unix Systems Programmer          Fax:    +61 8 349 6939
Academic Computing Service       E-mail: ccdn at levels.sait.oz.au
SA Institute of Technology       Post:   The Levels, South Australia, 5095



More information about the Comp.lang.c mailing list