Funny mistake

Paul Moore pmoore at hemel.bull.co.uk
Fri Mar 22 19:57:35 AEST 1991


what seems to be needed is a compiler that will generater a warning about
	if(a=b)
(lets own up here, we have all made this mistake at one time or another , I got
so paranoid about this recently that I ended up writing
	while((a==getchar())!=EOF)
Try fixing that one - and no compiler ever complains about "possible unintended
non assignment")

To stop the compiler moaning about perfectly good code how about a "yes I know
there's an = instead of ==" pragama. Ie

#pragma nowarn
	if(a=b)

The pragma just applies to the next statement
-- 
!---------------------------------------------------------------!
! Paul Moore, Bull HN UK, Maxted Rd,Hemel Hempstead, HP2 7DZ.   !
! Phone:(44) 442 232222  Fax:(44) 442 234084			!	
! pmoore at hemel.bull.co.uk     "a smile, a song and a core dump" !
!---------------------------------------------------------------!



More information about the Comp.lang.c mailing list