Re: 3.3.9 build error in SquidString.h

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Wed, 25 Sep 2013 08:40:32 -0600

On 09/25/2013 06:39 AM, Amos Jeffries wrote:
> As some of you know I have been working with a sponsor to get Windows
> builds going again this year.
>
> Visual Studio is giving me a strange error though in our SquidString.h
> code:
> error C2057: expected constant expression
>
> this is occuring on the code line:
> statis const size_type npos = std::string::npos;
>
> any ideas about how to solve this one properly? for now we are having to
> just define it as -1 by looking up the VC header files definitions of
> std::string::npos manually.

There is a long discussion about this at

http://compgroups.net/comp.lang.c++/isn-t-std-string-npos-an-integral-constant/1043674

There are a couple of interesting explanations offered, including
allegations of an STL implementation bug, but no final resolution (and
the explanations may not apply to our specific case).

Suggestions:

1) Try moving String::npos initialization into String.cc.

2) If #1 alone does not help, try #1 with casted -1 instead of npos.

HTH,

Alex.
Received on Wed Sep 25 2013 - 14:40:52 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 25 2013 - 12:00:16 MDT