NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: John Chamberlain on September 07, 2012, 11:38:51 PM

Title: Linker warning 32 to 64 bit in disasm.c
Post by: John Chamberlain on September 07, 2012, 11:38:51 PM
Hi there seems to be a type conversion issue in disasm.c at several points. For example, there is the code:

  if (autosync) add_sync(offs, 0L);

at line 1275, where add_sync is defined as:

void add_sync(uint32_t pos, uint32_t length)

and "offs" is defined as:

int64_t offs;

Obviously this is going to generate a warning. Any opinions about the right way to eliminate this warning?
Title: Re: Linker warning 32 to 64 bit in disasm.c
Post by: Frank Kotler on September 21, 2012, 08:12:09 PM
Hi John,

Sorry for the delayed reply. I suspect the "right" way to fix it is to make everything 64-bit. Probably(?) safe(?) to ignore?

Thanks for the feedback!

Best,
Frank

Title: Re: Linker warning 32 to 64 bit in disasm.c
Post by: Bryant Keller on September 22, 2012, 06:51:50 AM
I would say the "proper" way would be to use the greatest width variants in stdint.h

Code: [Select]
void add_sync(uintmax_t pos, uintmax_t length)
and

Code: [Select]
intmax_t offs;
These types represent the largest possible [un]signed integer types for our target platform respectively and would provide the greatest level of portability.