Re: [pcre-dev] [Bug 707] Patch: incorrect printf flags, comp…

Página Principal
Apagar esta mensagem
Autor: Zack Weinberg
Data:  
Para: 707
CC: pcre-dev
Assunto: Re: [pcre-dev] [Bug 707] Patch: incorrect printf flags, comparing string literals
On Wed, May 14, 2008 at 11:11 AM, Yang Zhang <yang.eximbugs@???> wrote:
> This came up for me because I'm on x86_64 which has 64-bit pointers. Hence the
> difference between two pointers (ptrdiff_t) can be 64-bit, so %d would be too
> small for printing these. %td is for ptrdiff_t (it instructs printf to parse
> the correct size for any architecture). Perhaps it's a GNU extension; I'm not
> sure (I just found it in the man page on my GNU/Linux box).


I believe %td is C99. However, it is not universal by a long shot.

Casting to long and using %ld would work on all platforms except
Win64, and IMO this constitutes sufficient brain damage in Win64 to
make it not worth supporting.

zw