Use of C99 features

Werner Koch wk at gnupg.org
Wed Oct 28 14:47:33 CET 2015


Hi!

GnuPG has always been coded for a C90 compliant compiler.  This greatly
helps with porability but some features of C99 are nice enough to
consider.  After talking to people who run many different Unix flavours
as weel as VMS, I'd like to allow ise of these features in GnuPG 2.x:

  1.4.1 C99 language features
  ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌

  In GnuPG 2.x, but *not in 1.4* and not in most libraries, a limited
  set of C99 features may be used:

  • Variadic macros:
    ┌────
    │ #define foo(a,...)  bar(a, __VA_ARGS__)
    └────

  • The predefined macro `__func__':
    ┌────
    │ log_debug ("%s: Problem with foo\n", __func__);
    └────

  • Variable declaration inside a for():
    ┌────
    │ for (int i = 0; i < 5; ++)
    │   bar (i);
    └────

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

We still need to evaluate whether to allow these features in other
related packages.


Salam-Shalom,

   Werner





More information about the Gnupg-devel mailing list