[Python-Dev] PY_FORMAT_SIZE_T warnings on OS X
tim.peters at gmail.com
Wed Apr 26 19:49:39 CEST 2006
>> I created patch 1474907 with a fix for it. Checks if %zd works for
>> size_t and if so sets PY_FORMAT_SIZE_T to "z", otherwise just doesn't
>> set the macro def.
>> Assigned to Martin to make sure I didn't foul it up, but pretty much
>> anyone could probably double-check it.
[Martin v. Löwis]
> Unfortunately, SF stopped sending emails when you get assigned an issue,
> so I didn't receive any message when you created that patch.
> I now reviewed it, and think the test might not fail properly on systems
> where %zd isn't supported.
I agree with Martin's patch comments. The C standards don't require
that printf fail if an unrecognized format gimmick is used (behavior
is explicitly "undefined" then). For example,
i = printf("%zd\n", (size_t)0);
prints "zd\n3\n" under all of MSVC 6.0, MSVC 7.1, and gcc (Cygwin) on
WinXP. Using sprintf instead and checking the string produced seems
much more likely to work.
After the trunk freeze melts, I suggest just _trying_ stuff. The
buildbot system covers a bunch of platforms now, and when trying to
out-hack ill-defined C stuff "try it and see" is easier than thinking
More information about the Python-Dev