Boost logo

Boost Users :

Subject: Re: [Boost-users] xpressive
From: Eric Niebler (eric_at_[hidden])
Date: 2011-05-07 09:57:12


On 5/7/2011 7:42 PM, Louis Lavery wrote:
> On 07/05/2011 11:27, Eric Niebler wrote:
>> On 5/7/2011 1:56 AM, Louis Lavery wrote:
>>> Apart from the C4701 warning (which I can suppress for now) it seems
>>> happy compiling stuff like this...
>>>
>>> sregex rex = as_xpr("foo")>> _d>> "xyz";
>>>
>>> ...so long as I enable language extensions and use the pragma.
>>
>> Oh, you were using /Za? This switch is useless.
>
> It changes the compiler's behaviour so is surely not completely useless?

It's worse than useless. See below.

>> Even Microsoft's own
>> headers don't compiler with language extensions disabled.
>
> As far as I remember I've always used /Za with out any problems, maybe
> I've been lucky and never needed to #include the MS headers that require
> no /Za. I tend to use just the std containers, algorithm, iostream,
> string and such, just std C++ stuff.
>
> Maybe by "Microsoft's own headers" you mean those specific to Microsoft,
> in which case case I can see that /Za should be off.
> But then I don't use MS not standard code/headers as I need my code to
> compile under other compilers - so I want to stick to pure C++.
>
>> I used to work
>> in the MSVC group at Microsoft. Every time a customer complained about
>> /Za, they were told to simply stop using it.
>
> Well, yeah, they would say that wouldn't they.
>
> I would be a lot happier using xpressive if I didn't have to enable
> language extensions. I'm not sure exactly how I'm going to use it. It
> might be that I build a static lib, using xpressive, that I can link to
> and so still use /Za in my main code. If that restricts the power of
> xpressive and I need to use the templates directly, and so have to
> enable MS language extensions, I'll have to have a rethink.
>
> Please don't take this as criticism of xpressive (it's meant to be
> constructive criticism at worst), I'm keen on it. From what I've seen so
> far it's intuitive and easy to use.

The /Za switch breaks standard-conforming code. I even filed a bug about it:

https://connect.microsoft.com/VisualStudio/feedback/details/486253/name-lookup-broken-with-za

This is exactly the problem in xpressive that you're running into. (I
just confirmed it.) As you can see, that bug was closed "won't fix."

I'll say it again: don't use /Za for ANYTHING. It's broken.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net