Atomic #defines (was Re: Password checking program)

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Aug 19 15:22:45 AEST 1989


In article <3019 at solo1.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>What should he use instead?
>	#define	ERROR	(-2)
>... might not work either!

I already answered that:  He should not attempt to add his own extensions
onto the getc() extended range (characters + EOF), but should define his
own special values.  For example:
	int my_getch() {
		int	c = getchar();
		return c != EOF ? c : ferror(stdin) ? MY_ERR : MY_EOF;
	}
where MY_ERR and MY_EOF are any two distinct negative ints.



More information about the Comp.lang.c mailing list