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: Ben Bacarisse
Subject: Re: insert-header-preprocessor-definition
Date: Sun, 15 Apr 2018 22:10:22 +0100

Emanuel Berg <address@hidden> writes:

> Ben Bacarisse wrote:
>
>> The C standard lists, for every header, any
>> patterns of macro names that are reserved to
>> the implementation. errno.h, for example,
>> reserves all macro names that start
>> E followed by a digit or another upper case
>> latter. Thus a program that uses ERROR_H
>> whilst also including errno.h is technically
>> undefined even if errno.h does not actually
>> use that macro name.
>>
>> None of the headers reserve any names that
>> start H_
>
> Right, but what about stuff that aren't part of
> the C standard library?

I'm not sure what to say about that.  That's a well-known problem with
no ideal solution.  And what might be a suitable non-ideal solution
will, most likely, vary from project to project.

But if more and more people use H_ to start guards, that will become a
de-facto standard and will discourage the use of H_ names for other
uses.

Alternatively, you could use a standard-C safe prefix that is very
unlikely to be used by anything else:

  #ifdef Emanuel_Berg_EMACS_GENERATED_GUARD_FOR_COLOR_H

(Em... is not reserved by errno.h)

-- 
Ben.


reply via email to

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