how widespread is this cpp bug?

Dave Hammond daveh at marob.MASA.COM
Fri Dec 2 22:43:46 AEST 1988


In article <49179 at pyramid.pyramid.com> markhall at pyramid.UUCP (Mark Hall) writes:
>The following code compiles and runs on pyramid, att-3b2, and sun3:
>
>	#include <stdio.h>
>	main() 
>	{
>		prin/* comment in the middle */tf ( "Hello World.\n" );
>	}
>
>But, according to K&R pg. 179:
>
>	``... comments [...] as described below
>	are ignored except as they serve to separate tokens.''
>
>So the above program is actually in error, as `prin' and `tf' should
>Does your cpp have this `feature'?

On Xenix 386 (SCO 2.3.1), cpp gets it right:

------------------------------ snip snip ------------------------------
#include <stdio.h>

main(argc, argv)
int argc; char *argv[];
{
prin/*comment*/tf ("hello, world\n");
}
------------------------------ snip snip ------------------------------

$ cc foo.c
foo.c
foo.c(7) : error 65: 'prin' : undefined
foo.c(7) : error 61: syntax error : identifier 'tf'
$

--
Dave Hammond
...!uunet!masa.com!{marob,dsix2}!daveh



More information about the Comp.lang.c mailing list