[C++-sig] GNU gettext and "_"
David Abrahams
david.abrahams at rcn.com
Thu Jun 20 15:44:47 CEST 2002
----- Original Message -----
From: "Pearu Peterson" <pearu at cens.ioc.ee>
> "Obvious" to me would be to use the same convention as used in Python
> slice object, that is,
>
> x[:y] would be x.slice(None,y)
> x[:y:] would be x.slice(None,y,None)
> etc.
Unfortunately not equivalent.
>>> range(10)[slice(None:3)]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: sequence index must be integer
> > I suppose we could check "#if defined(_)" and supply some other symbol
for
> > those people who need gettext compatibility.
>
> -1. It would mean that there will be two groups of BPL users who cannot
> use each other codes, very roughly speaking.
No, the method that doesn't collide with "_" would be ugly, but would work
everywhere (for now).
However, I don't really want to bend over backwards to stay out of the way
of gettext. There is simply no way to protect yourself from macros. If we
invent a name that we think is safe, say, "nil", somebody will #define nil
0. As a matter of fact, Apple does that in their system headers.
So, what I'm thinking of is something like:
enum slice_nil
{
#ifndef _
_
#endif
};
So people using systems where "_" is defined can write slice_nil() instead.
-Dave
More information about the Cplusplus-sig
mailing list