linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* using compile-time "assertions"
@ 2005-06-05 20:36 Robert P. J. Day
  2005-06-06  1:08 ` Glynn Clements
  0 siblings, 1 reply; 3+ messages in thread
From: Robert P. J. Day @ 2005-06-05 20:36 UTC (permalink / raw)
  To: C programming list


  another question (one of undoubtedly many) regarding the code i
inherited.  in this code, there is liberal use of the following macro:

#define INVARIANT(e) \
  do { \
    struct whatever { char static_assertion[(e) ? 1 : -1]; }; \
    } while (0)

which i recognize as a *compile-time* assertion/invariant.  is this a
common construct?  just curious.  or is there a more popular variant
of this sort of thing?  i recognize its value but, geez, there's
hundreds of these things in the code. :-P

rday

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-06 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-05 20:36 using compile-time "assertions" Robert P. J. Day
2005-06-06  1:08 ` Glynn Clements
2005-06-06 21:01   ` Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).