Use of C99 features

Robert J. Hansen rjh at
Wed Oct 28 15:20:35 CET 2015

> GnuPG has always been coded for a C90 compliant compiler.  This greatly
> helps with portability...

There's another benefit here: although I haven't done so recently, in
the past it was possible to compile GnuPG with a C++ compiler.  C++ has
much stricter type rules, and in my experience C++ compilers are more
demanding than C compilers in terms of what bad programming habits they
will or won't accept.  I used to run GnuPG through a C++ compiler as my
own little smoke test, in order to see if there were any problems the
C++ compiler saw which the C compiler didn't.

It may be worth considering whether we'd like to hold onto this
capability.  Fortunately, the proposed changes so far preserve it.
Every change proposed here is present in the C++11 standard, so... go
for it.  But there are other C99isms that break C++ compatibility, and
I'd recommend we think about whether it's worth it.

>   Although we usually make use of the `u16', `u32', and `u64' types, it
>   is also possible to include `<stdint.h>' and use `int16_t', `int32_t',
>   `int64_t', `uint16_t', `uint32_t', and `uint64_t'.  But do not use
>   `int8_t' or `uint8_t'.

I'd prefer to see the constants from stdint.h be used.

More information about the Gnupg-devel mailing list