Author Topic: Linker warning 32 to 64 bit in disasm.c  (Read 9537 times)

Offline John Chamberlain

  • New Member
  • Posts: 1
Linker warning 32 to 64 bit in disasm.c
« 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?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Linker warning 32 to 64 bit in disasm.c
« Reply #1 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


Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: Linker warning 32 to 64 bit in disasm.c
« Reply #2 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.

About Bryant Keller
bkeller@about.me