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

Rodentia tom at syssoft.com
Fri Apr 5 07:56:05 AEST 1991


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.

Does this mean that there if c is char, there is no way to assign the
getchar and test it for EOF without having it cast down to char?

Or would "while (((int)c = getchar()) != EOF)" do it?

If so, would "while ((((int)(*c++)) = getchar()) != EOF)" cause improper
incrementation, access, both, or worse?
-- 
Thomas Roden                                      | tom at syssoft.com
Systems and Software, Inc.                        | Voice: (714) 833-1700 x454 
"If the Beagle had sailed here, Darwin would have | FAX:   (714) 833-1900
come up with a different theory altogether." - me |



More information about the Comp.lang.c mailing list