On Tue, Nov 28, 2006 at 06:26:49PM +0100, Georg Baum wrote:
> Enrico Forestieri wrote:
> 
> > You maybe right, but without the terminator I see red names, whereas
> > with the zero-terminator I see the symbols... Indeed, I was so sure
> > that it had worked without the terminator that I didn't bothered to
> > check it, at first.
> 
> That means that there is some other problem that is hidden by the \0. IMO it
> is worth to investigate that, but this is of course your choice since you
> are the one who uses this code.

I did that. It turned out that the compiler num_get implementation
finishes like this:

        if (__beg == __end)
          __err |= ios_base::eofbit;
        return __beg;

So, if there's nothing after the last character part of the number being
read, the eofbit is set, invalidating the read itself!

I don't know if this is a bug (it seems so to me), but anyway...
Note that it would suffice appending any character not being part of
the current numpunct facet, so the '\0' is pretty ok.

I'll add a comment to the code, in case someone wants to do a cleanup ;-)

-- 
Enrico

Reply via email to