[Swan-dev] true or TRUE?
andrew.cagney at gmail.com
Sun Apr 22 01:17:18 UTC 2018
I see 91f7de765cefc33bd8685b6d69d31db64462e4c5 replaced #include
<stdbool.h> with an include of linux/include/libreswan.h , When
compared to the contents of "libreswan.h", what the neighbour's dog
thew up in the front yard looks neat and tidy. The only real
purpose of that file is to keep linix centri code shared between pluto
and klips (kernel) happy, new non-kernel code really doesn't need to
be including it.
Now we could of course try to extract TRUE and FALSE from
"libreswan.h" and, say, create a new standalone libreswan centric
header ("lswbool.h"?). But lets be honest, to what end? We've
already got <stdbool.h>, and its been around for going on 18 years
now, so lets use it.
On 21 April 2018 at 19:50, D. Hugh Redelmeier <hugh at mimosa.com> wrote:
> libreswan's code base was developed before <stdbool.h> was invented.
> I introduced our own equivalent early on. Now that <stdbool.h>
> exists, we use it.
> Our code has used TRUE and FALSE whereas <stdbool.h> defines true and
> Some new code has used true and false.
> We should fix the code base to be consistent. Should we use TRUE or
> Which convention do you prefer? Why?
> I prefer the all-caps version.
> It is consistent with other constants that are conventional (eg. NULL).
> TRUE and FALSE don't look like variable names or function names. This
> should make the code easier to understand at a glance.
> It is what we've alway used. (Except for some new code.)
> On the other hand, if we used the lower-case names, we could eliminate
> libreswan's definitions of the upper case version, saving four
> #defines. It also matches what new projects use.
> When we settle this, and there are no branches in flight, I'd like to make
> the code consistent.
> Swan-dev mailing list
> Swan-dev at lists.libreswan.org
More information about the Swan-dev