NULL holy wars and a challenge
hood at osiris.cso.uiuc.edu
hood at osiris.cso.uiuc.edu
Sat Oct 8 03:06:00 AEST 1988
I may be starting the "NULL Holy Wars" over again, but I'm *really*
want to know if there is *ANY* machine out there that the following
program will:
a) not compile
b) not run (and give the expected output).
I rather doubt there is...
Mind you, I'm not in the least concerned about warning messages from
your compiler... I want to know if it will *RUN* correctly.
Emmet P. Gray US Army, HQ III Corps & Fort Hood
...!uunet!uiucuxc!fthood!egray Attn: AFZF-DE-ENV
Directorate of Engineering & Housing
Environmental Management Office
Fort Hood, TX 76544-5057
---------------------------------------------------------------------------
main()
{
char *p, *s;
struct junk {
int i;
float f;
char c;
};
s = "hello world\n";
p = s;
printf("testing '\\0' :\t\t\t");
while(*p != '\0') {
putchar(*p);
p++;
}
p = s;
printf("testing 0 :\t\t\t");
while(*p != 0) {
putchar(*p);
p++;
}
p = s;
printf("testing 0L :\t\t\t");
while(*p != 0L) {
putchar(*p);
p++;
}
p = s;
printf("testing (char *)0 :\t\t");
while(*p != (char *)0) {
putchar(*p);
p++;
}
p = s;
printf("testing (void *)0 :\t\t");
while(*p != (void *)0) {
putchar(*p);
p++;
}
p = s;
printf("testing (struct junk *)0 :\t");
while(*p != (struct junk *)0) {
putchar(*p);
p++;
}
}
More information about the Comp.unix.xenix
mailing list