This one bit me today

David Burhans dwb at sppy00.UUCP
Fri Oct 6 01:07:38 AEST 1989


In article <2432 at hub.UUCP> dougp at voodoo.ucsb.edu writes:
1> main()
2>   {
3>   int a=1,b=2,*p=&a,c;
4>   c=b/*p;
5>   }
 >
 > First real flaw in the C grammer I have found.

This is not a flaw in the C grammer, it is a flaw in the c programmer.

Don't expect a compiler to second guess you.  Line 4 contains an
assignment and the start of a comment.  As there is no end of comment,
you should get an error message along the lines of ``unterminated
comment.''  Try the following:
  c = b / *p;
White space not only solves your problem, it makes your code more readable.

Also, in line 3 you have an illegal compination of an int * and an int.
Once again, white space solves your problem.

 -DwB
-- 
dwb at sppy00	{att|killer|pyramid}!osu-cis!sppy00!dwb	
David Burhans/6565 Frantz Rd./Columbus, Oh 43017
  ****  Views expressed above were randomly generated with a six
  	sided die and as such are not the views of my employer.   *****



More information about the Comp.lang.c mailing list