Boost logo

Boost Users :

Subject: Re: [Boost-users] [Preprocessor] MSVC nonstandard macro expansion workaround?
From: paul Fultz (pfultz2_at_[hidden])
Date: 2016-03-03 14:37:44


> On Thursday, March 3, 2016 7:50 AM, "rleigh_at_[hidden]" <rleigh_at_[hidden]> wrote:

> > Hi folks,
>
> I've been trying to get Boost.Preprocessor to run a nested for loop over
> two sequences to output nested switch blocks and case statements. This
> works fine with GCC and clang. Unfortunately it's broken with MSVC. If
> anyone had any thoughts on what I might need to tweak to enable the code
> to work with MSVC, I'd be very appreciative. Even if it's as nasty as a
>

> big ifdef with an alternative set of macros!

I don't have MSVC available to test this right now, but you could try adding an extra scan and avoid using strange operator combinations as well:

BOOST_PP_EXPAND(BOOST_PP_EXPAND(BOOST_PP_SEQ_FOR_EACH(LT_TOPLEVEL,, LASERTYPE_VALUES)));

If that doesn't work. Would you be able to post the PP output of what gets expanded inside of main? This would help diagnose the issue, until someone can look at it with MSVC.

>
> I've spent hours tweaking the testcase to try to make this work, but so
> far without success. It doesn't help that I don't fully understand what
>
> specifically is broken with the MSVC preprocessor, or how to work around

> whatever is behaving in a non-stanadard way.
>

The MSVC preprocessor works in a mysterious way, that its difficult to understand why it fails in one situation and not the other.

Paul


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