Mail Archives: djgpp/1999/04/14/13:56:51
> Look at this:
> #include <stdio.h>
>
> typedef char /*int*/ BOOL;
> #define TRUE 1
> #define FALSE 0
>
> main() {
> BOOL flag=(BOOL)isupper('E');
> puts(flag?"*TRUE*":"*FALSE*");
> return 0;
> }
>
> It fails with BOOL as char, but works as int
> Can someone explain this reasonably?
> It works well with Borland
> I have been using this typedef for years and it seems standard, robust,
> good, pretty, simple, near-machine, fast, compact...
> It seems gods of chaos are conquering the world of computing
Gods of old-fashioned programming, rather... People since 1970 have
found ways to have standard,...,compact typedefs you'll never
have to wonder whether it works or not...
flag: boolean:= isupper('E');
begin
put(boolean'image(flag));
;-)
Gautier
- Raw text -