🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3652

Re: Incrementing a bool

#3652
From: Peter Holzer
Date: Fri, 04 Aug 1995 17:44
54 lines
2749 bytes
kanze@gabi-soft.fr (J. Kanze) writes:

>Peter Seebach (seebs@solutions.solon.com) wrote:
>|> In article <3va943$im@gabi.gabi-soft.fr>, J. Kanze <kanze@gabi-soft.fr> wrote:
>|> More generally, though, what I *really* say is "if pointer". Come
>|> on, in English, does one say "if that I am going to the store is
>|> true"? No. You say "If I'm going to the store".

>|> In C, I don't say "if this pointer is not null". I say "if this   ".
>|> pointer I don't say "if this expression is non zero", I say "If   ".
>|> this expression                                                   ".

>This is a false analogy.  `I am going to the store' is a statement that
>can be true or false.  `This pointer' or `this expression' is not a
>complete statement.

While I don't say `if this pointer' either and can't comment on
`if this expression' unless I know what `this expression' is,
I also write things like 

while (p) {
	flurble(p);
	p = p->next;
}

because I read this as

"while there is a p, flurble it and take the next one."

I don't see this as a comparison against a null pointer, although
technically, of course it is.

>For me, at least, `ptr' is an object (with a set of values and a set of
>legal operations, thus with a specific type).  An object is, in fact, a
>noun.  Grammatically, a noun can only be used with a verb, thus:

But a variable of type bool is also an object with a set of values and
a set of legal operations. It must therefore also be considered as a
noun and be used with a verb ...

Generally, I think C does not need a builtin bool type. Because many
programmers want a two-valued type for flags (as the plethora of
bool, Bool, boolean, bool_t, etc. typedefs and defines shows) I
think there should be a standardized header file which declares such
a type and two symbolic names for 0 and 1. The type should basically
behave like an enum or a `int atleast:1' if extended precision integers
are accepted (which I hope, btw).

	hp
--
   _  | Peter Holzer | Systemadministrator WSR | hjp@wsr.ac.at
|_|_) |-------------------------------------------------------
| |   |  ...and it's finished!  It only has to be written.
__/   |         -- Karl Lehenbauer
Technical Details
Message-ID: <3vtm9b$ag9@wsrcom.wsr.ac.at>
Path: arc1-ca.pugleaf.net!wsrcom.wsr.ac.at!wsrdb!hjp
References: <KANZE.95Jul19114530@slsvhdt.lts.sel.alcatel.de> <KANZE.95Jul26122240@slsvhdt.lts.sel.alcatel.de> <3v74hd$ndb@caip.rutgers.edu> <3va943$im@gabi.gabi-soft.fr> <3vl72l$dp9@solutions.solon.com> <3vq4uf$2lh@gabi.gabi-soft.fr>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wsrcom.wsr.ac.at!wsrdb!hjp
From: hjp@wsrdb.wsr.ac.at (Peter Holzer)
Newsgroups: comp.std.c
Subject: Re: Incrementing a bool
Date: 4 Aug 1995 17:44:11 GMT
Organization: WSR, Vienna, Austria
Message-ID: <3vtm9b$ag9@wsrcom.wsr.ac.at>
References: <KANZE.95Jul19114530@slsvhdt.lts.sel.alcatel.de> <KANZE.95Jul26122240@slsvhdt.lts.sel.alcatel.de> <3v74hd$ndb@caip.rutgers.edu> <3va943$im@gabi.gabi-soft.fr> <3vl72l$dp9@solutions.solon.com> <3vq4uf$2lh@gabi.gabi-soft.fr>
NNTP-Posting-Host: wsrdb.wsr.ac.at