Assignment in test: OK?

Silver gaynor at sparky.rutgers.edu
Sat Sep 15 00:39:44 AEST 1990


I don't have any problems with the concept of performing assignments and other
destructive things in conditionals.  The only reason why people question the
practice in C is because the stupid equality and assignment operators appear so
similar.  If I had my way, assignment would be `<-' and equality, `='.  Hmm...
Given the relationships between &/&&/&= and |/||/|=, `=' should probably be
bitwise equality (i.e., `a == b' would be equivalent to `~(a ^ b)'), `=='
should probably be logical equality, and `=<-' should probably apply to the
bitwise version.  But I could imagine people messing up that even worse than
the current set-up.

Regards, [Ag]



More information about the Comp.lang.c mailing list