I'm trying to get started with boost xpressive, but have problems with
this simple attempt...
#pragma warning(disable:4180) // MSVC: qualifier applied to function
type has no meaning; ignored
#pragma warning(disable:4224) // MSVC: nonstandard extension used :
formal parameter 'value' was previously defined as a type
#pragma warning(disable:4996) // MSVC: 'std::transform' was declared
deprecated
#include
On 5/5/2011 8:59 PM, Louis Lavery wrote:
I'm trying to get started with boost xpressive, but have problems with this simple attempt...
#pragma warning(disable:4180) // MSVC: qualifier applied to function type has no meaning; ignored #pragma warning(disable:4224) // MSVC: nonstandard extension used : formal parameter 'value' was previously defined as a type #pragma warning(disable:4996) // MSVC: 'std::transform' was declared deprecated
Do you really need these pragmas? 'std::transform' was declared deprecated? If you're really seeing this warning, something might be wrong with your setup.
#include
void f() { using namespace boost::xpressive;
sregex rex = as_xpr('k'); }
...which gives these errors...
------ Build started: Project: miscTest, Configuration: Debug Win32 ------ Compiling... main.cpp c:\boost_1_45_0\boost\xpressive\detail\static\transforms\as_matcher.hpp(27) : error C2146: syntax error : missing ';' before identifier 'data_type'
<snip> What version of MSVC is this? I'm sorry, I can't reproduce this error on trunk. Are you really using Boost 1.45.0 like the error message suggests? I'm attempting to download it now, but I'm on a slow, unreliable connection. It could be a while. Can you try this regex: sregex rex = as_xpr("foo"); That's xpressive's very first test case. I guarantee when 1.45.0 went out the door, this regex worked with every version of MSVC above 7.0. -- Eric Niebler BoostPro Computing http://www.boostpro.com
On 06/05/2011 04:03, Eric Niebler wrote:
On 5/5/2011 8:59 PM, Louis Lavery wrote: [snip]
What version of MSVC is this?
Visual C++ 2008 express
I'm sorry, I can't reproduce this error on trunk. Are you really using Boost 1.45.0 like the error message suggests? I'm attempting to download it now, but I'm on a slow, unreliable connection. It could be a while.
Can you try this regex:
sregex rex = as_xpr("foo");
That's xpressive's very first test case. I guarantee when 1.45.0 went out the door, this regex worked with every version of MSVC above 7.0.
I've tried this...
#pragma warning(disable:4996)
#include
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. Even Microsoft's own headers don't compiler with language extensions disabled. 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. -- Eric Niebler BoostPro Computing http://www.boostpro.com
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? 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. Louis.
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?
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++.
Unless you are using STLPort, you are using Microsoft headers already, albeit probably less sensitive to /Za. Jeff
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-look... 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
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Eric Niebler Sent: Saturday, May 07, 2011 2:57 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] xpressive
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-look...
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.
I second this (from recent bad experience), and have updated and strengthened the recommendations at https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines to say loudly "Don't use /Za for ANYTHING. It's BROKEN - and won't be fixed." Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com
On Thu, May 5, 2011 at 8:03 PM, Eric Niebler
On 5/5/2011 8:59 PM, Louis Lavery wrote:
I'm trying to get started with boost xpressive, but have problems with this simple attempt...
#pragma warning(disable:4180) // MSVC: qualifier applied to function type has no meaning; ignored #pragma warning(disable:4224) // MSVC: nonstandard extension used : formal parameter 'value' was previously defined as a type #pragma warning(disable:4996) // MSVC: 'std::transform' was declared deprecated
Do you really need these pragmas? 'std::transform' was declared deprecated? If you're really seeing this warning, something might be wrong with your setup.
The deprecated std::transform is likely due to VC++ pushing you to use their non-standard "safe" functions that perform bounds checking. You can disable that with a #define _SCL_SECURE_NO_WARNINGS before you include any headers. That doesn't account for the other errors, though. -- Cory Nelson http://int64.org
On 07/05/2011 00:08, Cory Nelson wrote:
On Thu, May 5, 2011 at 8:03 PM, Eric Niebler
wrote: On 5/5/2011 8:59 PM, Louis Lavery wrote:
I'm trying to get started with boost xpressive, but have problems with this simple attempt...
#pragma warning(disable:4180) // MSVC: qualifier applied to function type has no meaning; ignored #pragma warning(disable:4224) // MSVC: nonstandard extension used : formal parameter 'value' was previously defined as a type #pragma warning(disable:4996) // MSVC: 'std::transform' was declared deprecated
Do you really need these pragmas? 'std::transform' was declared deprecated? If you're really seeing this warning, something might be wrong with your setup.
The deprecated std::transform is likely due to VC++ pushing you to use their non-standard "safe" functions that perform bounds checking. You can disable that with a #define _SCL_SECURE_NO_WARNINGS before you include any headers. That doesn't account for the other errors, though.
Yes, I have now got VC++ to compile it with _SCL_SECURE_NO_WARNINGS on the command line to suppress the warnings, I don't want it in the code itself as I'm also compiling using gcc (4.4.1) (that doesn't seem to have any trouble with xpressive). The only thing that really bothers me is that I'm compiling under VC++ with language extensions enabled, I would prefer to have them turned off. BTW, I'm compiling with warnings at level 4. thanks, Louis.
participants (5)
-
Cory Nelson
-
Eric Niebler
-
Jeff Flinn
-
Louis Lavery
-
Paul A. Bristow