One more point regarding = and == (more flamage)

Blair P. Houghton bhoughto at nevin.intel.com
Thu Apr 4 14:23:46 AEST 1991


In article <29444:Mar3120:23:3491 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>In article <3465 at litchi.bbn.com> rsalz at bbn.com (Rich Salz) writes:
>> In <3555 at inews.intel.com> bhoughto at hopi.intel.com (Blair P. Houghton) writes:
>> >toupper.c:    while ( (int) (c = getchar()) != EOF )
>> The cast implies that c is char.  If so, this line is buggy.
>
>Maybe it's long? :-)

No, actually it's a quad double pointer to a function returning
a far union of wchar_t and an odd-length bit field.  It's also
several years old and the cast was inserted to shut lint up,
not to fix the bad conversion, which deserves

	while ( ( c = (char) getchar() ) != (char)EOF )

or, if you prefer,

	int i;
	while ( ( i = getchar() ) != EOF )
	    c = (char)i;

				--Blair
				  "Call For Votes:
				   comp.lang.c.kludges.just.to.shut.lint.up"



More information about the Comp.lang.c mailing list