bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Module with preprocessor utilities


From: Marc Nieper-Wißkirchen
Subject: Re: Module with preprocessor utilities
Date: Mon, 20 Jul 2020 20:26:36 +0200

Thank you for your input. So I won't come up with a full-featured
(meta-programming) macro module but may propose one or the other small
module about macros that I have found useful (and fool-proof) in my
own code.

The amount of macro one needs depends on the programming style, of
course. For example, do we want to encourage the writing of
sophisticated macros like the TRACE macros in chapter 16 of (the IMHO
opinionated) book Modern C ([1]). In that case, we don't want to write
STRGY or ALEN everytime.

Marc

--

[1] https://gforge.inria.fr/frs/download.php/latestfile/5298/ModernC.pdf

Am Mo., 20. Juli 2020 um 20:14 Uhr schrieb Paul Eggert <eggert@cs.ucla.edu>:
>
> I'm a bit leery of this idea, as it is painful to write and debug reliable
> preprocessor macros. When you need macros you really need them, but they're 
> best
> avoided in the first place.
>
> The fanciest macros I've contributed to Gnulib are in <intprops.h>; they had 
> to
> be macros because C won't let you write polymorphic functions. A quick look at
> the P99 package suggests it wouldn't have helped me write or debug the
> intprops.h macros, and that it's intended more for meta-macro programming,
> something that gets pretty hairy pretty quickly and something I'm not sure I'd
> like to encourage. (Reading the warning for P99_IS_EMPTY gives me the willies,
> for example.)
>
> That being said, if there's a need for a particular macro for something
> Gnulibish then of course we should be all ears.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]