help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: insert-header-preprocessor-definition


From: Emanuel Berg
Subject: Re: insert-header-preprocessor-definition
Date: Wed, 11 Apr 2018 22:41:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Ben Bacarisse wrote:

> this common construction can give rise to C's
> dreaded "undefined behaviour". All sorts of
> macro names are reserved to the
> implementation depending on what headers have
> been included in the source file that
> includes this one.
>
> It's common to ignore this rule, but if you
> are providing a facility for general use it
> might be better to follow letter of the law.
> Pre-pending "H_" to the label is known to
> be safe.

I agree. So for color.c, color.h should have
H_COLOR_H?

>>         (beg-string (concat
>>                      (format "#ifndef %s\n"   label)
>>                      (format "#define %s\n\n" label) ))
>
> I'd probably write
>
>   (concat "#ifndef " label "\n"
>           "#define " label "\n\n")

OK!

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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