[Swan-dev] true or TRUE?

D. Hugh Redelmeier hugh at mimosa.com
Sat Apr 21 23:50:11 UTC 2018


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 
false.

Some new code has used true and false.

We should fix the code base to be consistent.  Should we use TRUE or
true?

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.


More information about the Swan-dev mailing list