On Sun, Oct 25, 2020 at 10:25 AM Gavin Smith <[email protected]> wrote:
> > parsetexi/api.c: In function ‘element_to_perl_hash’:
> > parsetexi/api.c:429:27: warning: cast from pointer to integer of different 
> > size [-Wpointer-to-int-cast]
> >   429 |               int value = (int) f;
> >       |                           ^
>
> There's not much chance of an overflow here but to avoid the warnings,
> another integer type could be used instead.

I changed it to a long and IV (a typedef from Perl) instead and the
warnings go away.

long may not be as big as a pointer on MS-Windows but the worse that
is going to happen is compiler warnings. It would in face be very rare
for numbers greater than, like, 5 to be stored in these variables, so
overflow is not a real risk.

There is a intptr_t type in the C standard that is as big as a
pointer, but I don't think we need to worry about it unless there are
more compiler warnings.

Reply via email to