Boost logo

Boost :

Subject: Re: [boost] [1.47.0] Permission to merge filesystem fix
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-07-03 22:26:52

On Sun, Jul 3, 2011 at 9:24 PM, Eric Niebler <eric_at_[hidden]> wrote:
> On 7/3/2011 2:48 PM, Beman Dawes wrote:
>> This changeset:
>> Has now cycled through many of the regression testers. Testing is
>> still a little light on Windows, but I've tested locally on VC++ 8, 9,
>> and 10, and late model mingw, too.
>> This fixes a nasty POSIX case that was throwing before main() started
>> if the environment LANG variable was whacked.
>> OK to merge?
> The changes in the .cpp just look like comments and formatting. Is that
> right? And the extra path constructors ... are there cases where the new
> behavior is different than the old?

The two added constructors are the critical change. Since their
argument is already of the required type and encoding, there is no
need to access the codecvt facet. And since there is no need for the
facet, there is also no need for constructing a std::locale("")

The path implementation, in src/path.cpp, constructs two paths with
the native value_type for internal use. Without the change, GCC thinks
that the construction of these two paths can be done as static
initialization, before main() runs. Thus if LANG is whacked, the
resulting exception from trying to construct std::locale("") is thrown
before mainj() starts. By adding the two constructors, that is
avoided. It is also a small, but nice, optimization for the most
common use case in code that runs on POSIX systems of narrow character
paths. Not to mention avoiding the exception entirely if the program
does no trafficking in wide character paths.

If your eye are glazing over, don't worry. It took me three days to
figure it out. Mostly learning to use Code::Blocks on Linux, and then
an hour of debugging and testing to see exactly what was happening.


Boost list run by bdawes at, gregod at, cpdaniel at, john at