PyDoc_STRVAR error in msvc compile

Dave Angel davea at davea.name
Wed Oct 2 06:49:47 EDT 2013


On 2/10/2013 06:01, Robin Becker wrote:

> On 02/10/2013 10:00, Robin Becker wrote:
>> On 01/10/2013 18:26, MRAB wrote:
>>> On 01/10/2013 17:41, Robin Becker wrote:
>> ..........
>>>>
>>> I've tried it in a minimal console program, and it seems to work for me.
>>>
>> thanks for the test. I thought this might be an issue with the macro call
>> argument being spread out over several lines, but since your try works I'll dig
>> deeper.
> I used -E to get the pre-processor output and it shows my string constant ends 
> up with the #ifdef inside it eg
>
>
>    ......\n" #ifdef    ZZZZ "    ZZZZ stuff\n" #endif "\n\....
>
> I looked for any obvious reason why that should happen, but cannot find anything.
>
> if I remove the internal #ifdef and replace with a macro containing the 
> conditional string or "" then MSVC 9 seems to be ok with it.
>

MSVC and other compilers do not not see eye to eye on the preprocessor
semantics.  I no longer use MSVC so I can't experiment.  I can only try
to recall extensive manipulation two decades ago.

I believe it does the logic of "backslash at the end of line" first.  So
if there are any spaces or tabs after those backslashes (which might
have been lost when you pasted it here), fix them first.

Then I think it looks for macro definitions, where the # must be the
first non-whitespace of the line.  Then it expands such macros, and I
think MSVC is unusual in that it expands them multiple times, so a macro
expansion can result in another macro invocation.

I'm not sure where quotes fit in here.

Your original message code doesn't match the expansion you show with -E,
so i suspect your "..." eliding hid something significant.

-- 
DaveA




More information about the Python-list mailing list