Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141016005842.GT32028@brightrain.aerifal.cx>
Date: Wed, 15 Oct 2014 20:58:43 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Constants to decode __ctype_b_loc() table

On Wed, Oct 15, 2014 at 10:19:46PM +0300, Sergey Dmitrouk wrote:
> On Wed, Oct 15, 2014 at 09:51:36AM -0700, Rich Felker wrote:
> > Basically, libstdc++ should be using ...
> 
> Well, I'm talking about libc++, not libstdc++.  libc++ doesn't have
> such headers and all is kept in one big locale.cpp.  It's easy to
> hard-wire these constants for generic case, but is it really correct
> solution?

No, using those interfaces AT ALL is incorrect. They are not a public
API but glibc implementation internals. The correct way to implement
the locale functionality in C++ is to call the ctype.h/wctype.h
functions, not using glibc implementation internals.

> It doesn't seem to be standardized.  Values in
> os/generic/ctype_base.h differ from those one can find in C++ standard.

The standard has no such thing. These are implementation details.

> There is even a comment:
> 
>     // Default information, may not be appropriate for specific host.
> 
> My point is that musl can have these masks defined to arbitrary values
> and there is currently no way for a client to know exact values.  It
> just happens to work, no guarantees.

No, the generic implementation does not use the glibc internals at
all. Since the rest of libstdc++'s locale support is written based on
the glibc internals, the generic implementation just provides an
interface that looks like the glibc one using standard functions.

> The question is whether you want to keep it in this somewhat incomplete
> state, when particular values of constants are assumed and undocumented (e.g.
> if this is really just for libstdc++, which can live without constants).

No, the question is whether we want to provide glibc internals as a
public API, and the answer is no.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.