Home Dashboard Directory Help
Search

"Forwarded" __VA_ARGS__ can't be split up? by demett


Status: 

Closed
 as Deferred Help for as Deferred


2
0
Sign in
to vote
Type: Bug
ID: 778757
Opened: 2/7/2013 10:11:12 AM
Access Restriction: Public
1
Workaround(s)
view
1
User(s) can reproduce this bug

Description

This:

#define WORKS(X, Z, ...) (Z, X, __VA_ARGS__)
#define DOESNT(X, ...) WORKS(X, __VA_ARGS__)
WORKS(1, 2, 3, 4, 5)
DOESNT(1, 2, 3, 4, 5)

preprocesses to:

(2, 1, 3, 4, 5)
(2, 3, 4, 5, 1 )

The DOESNT macro should expand to the same thing as the WORKS macro, but it doesn't. It looks like the preprocessor is avoiding splitting up the forwarded __VA_ARGS__.
Details
Sign in to post a comment.
Posted by Microsoft on 2/7/2013 at 6:38 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 2/7/2013 at 10:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by demett on 2/7/2013 at 10:12 AM
This particular case can be worked around by explicitly forwarding Z in the DOESNT macro:

#define WORKS(X, Z, ...) (Z, X, __VA_ARGS__)
#define DOESNT(X, Z, ...) WORKS(X, Z, __VA_ARGS__)
WORKS(1, 2, 3, 4, 5)
DOESNT(1, 2, 3, 4, 5) // Actually, it does now