Sujet : Re: encapsulating directory operations
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.cDate : 24. May 2025, 06:05:31
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <864ixavbs4.fsf@linuxsc.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Keith Thompson <Keith.S.Thompson+
u@gmail.com> writes:
Richard Harnden <richard.harnden@gmail.invalid> writes:
>
On 22/05/2025 23:32, Keith Thompson wrote:
>
"Paul Edwards" <mutazilah@gmail.com> writes:
>
[...]
>
In one of your library's headers:
extern const char ESCAPE;
In the corresponding *.c file:
const char ESCAPE = ('z' - 'a' == 25 ? '\x1b' : '\x27');
Change the name if you prefer.
>
Wouldn't that be a reserved identifier?
>
Yes, it would. Good catch.
>
(Identifiers starting with E followed by either a digit or an uppercase
letter are reserved; they could be defined as macros in <errno.h>.)
They are reserved only as macros, and only if <errno.h> has
been #include'd.
For this particular use, it's easy to make the definition work,
simply by adding
#undef ESCAPE
before the declaration in the header file, and before the
definition in the source file (assuming of course that if
there are any #include <errno.h> they precede the #undef's).