On Wednesday 29 March 2017, Petrus Hyvönen wrote:
> Hi,
>
> Yes, there are windows users :)
>
> I've ran a quick test, it builds fine on python 2.7 but I'm getting
> some linker error under python 3.6 and 3.5 (didn't try lower).
>
> The linker error states:
>
> jcc3/sources/jcc.cpp(202): error C3688: invalid literal suffix
> 'PRIxMAX'; literal operator or literal operator template
> 'operator ""PRIxMAX' not found
> jcc3/sources/jcc.cpp(202): error C2664: 'int sprintf(char *const
> ,const char *const ,...)': cannot convert argument 2 fr
> om 'int' to 'const char *const '
> jcc3/sources/jcc.cpp(202): note: Conversion from integral type to
> pointer type requires reinterpret_cast, C-style cast o
> r function-style cast
> error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio
> 14.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2
>
> the jcc.cpp code is:
> static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg)
> {
>     static const size_t hexdig = sizeof(uintmax_t) * 2;
>     uintmax_t hash = (uintmax_t) PyObject_Hash(arg);
>     char buffer[hexdig + 1];
>
>     sprintf(buffer, "%0*"PRIxMAX, (int) hexdig, hash);
>     return PyUnicode_FromStringAndSize(buffer, hexdig);
> }
>
> I don't understand the PRIxMAX stuff there, what does it mean?

Could you try to change 
    sprintf(buffer, "%0*"PRIxMAX, (int) hexdig, hash);
to
    sprintf(buffer, "%0*%jx", (int) hexdig, hash);

or if it still not works
    sprintf(buffer, "%0*%llx", (int) hexdig, (unsigned long long)hash);

cu,
Rudi

Reply via email to