Time to standardize "true" and "false"

ian at mva.cs.liv.ac.uk ian at mva.cs.liv.ac.uk
Sun Sep 24 03:58:43 AEST 1989


In article <1989Sep22.073138.19684 at lth.se>, newsuser at lth.se (LTH network news server) writes:
> I completely agree that a boolean data type is needed in C++.  I
> think the definition should define the following properties:
> 
> 	1.  The data type is called "boolean".
>
That's just what _you_ want to call it! Why not call it `bool' or
`logical' or even `int'?

> 	2.  The allowed values are "false" and "true".
>
Why not call them `f' and `t' or `F' and `T' or even `0' and `1'?

> 	3.  int(false) = 0 and int(true) = 1
>
Well, int (0) = 0 and int (1) = 1.

> 	4.  boolean(0) = false, other values are true
>
Wouldn't it be great for conditionals in C to be false if they are testing
integer 0 and to be true if they are testing any other integer? That way
we could use integers instead of a new boolean type. Oh, looks like they
already do that!

Why do we need to introduce a new data type to do the job of a data type
we already have, but in a more complex way?

Ian Finch              Janet: ian at uk.ac.liv.cs.mva
---------              Internet: ian%mva.cs.liv.ac.uk at cunyvm.cuny.edu
                       UUCP: ...mcvax!ukc!ian at uk.ac.liv.cs.mva
===============================================================================
What's a word processor? Well, you know what a food processor does to food ...



More information about the Comp.lang.c mailing list