[BusyBox] EOF != (char)EOF

Pavel Roskin proski at gnu.org
Mon Jul 17 16:11:53 UTC 2000


Hello!

Please don't ever put the result of getopt() to a char variable!
This way you cannot distinguish between '\0xff' and EOF.
This is fatal for PPC where "char" is unsigned by default, so

EOF != (char)EOF

But it is bad for other architectures too because you lose the ability to
use international characters. '\0xff' is meaningful in several encodings.
One must be a strange guy to run

eval `echo -e 'date -\377'`

but don't forget that crackers are strange guys too. Besides, clean code
is better than dirty code.

Regards,
Pavel Roskin






More information about the busybox mailing list