hood@osiris.cso.uiuc.edu (10/08/88)
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++;
	}
}edf@rocky2.rockefeller.edu (David MacKenzie) (10/09/88)
The program posted fails to compile under MS-DOS using Manx Aztec C v3.20d, small model, with "illegal type conversion" errors on the while()s with (char *), (void *), and (struct junk *). Challenge met? ----- David MacKenzie Environmental Defense Fund edf@rocky2.rockefeller.edu (...rutgers!cmcl2!rocky2!edf)
MichaelNC@cup.portal.com (10/11/88)
The nulltest compiled (with "Warning(47) different levels of indirection"). It ran just fine. I also took a look at the generated code, and it was identical for all the loops. This is on SCO Xenix 2.2.3, Development System 2.2.1 (286 version) Michael Brady michaelnc@cup.portal.com sun!portal!cup.portal.com!michaelnc