From: H. P. A. <hp...@zy...> - 2008-06-22 08:24:37
|
nicolas sitbon wrote: > I'm currently reading nasm source code, when I compile it with my own > flag, I got lots of errors about comparison between signed and unsigned. > it seems there are lots of incorrect use of type. for exemple, in > assemble.c : > > typedef struct { > int sib_present; /* is a SIB byte necessary? */ > int bytes; /* # of bytes of offset needed */ > int size; /* lazy - this is sib+bytes+1 */ > uint8_t modrm, sib, rex, rip; /* the bytes themselves */ > } ea; > > why don't use > typedef struct { > bool sib_present; /* is a SIB byte necessary? */ > size_t bytes; /* # of bytes of offset needed */ > size_t size; /* lazy - this is sib+bytes+1 */ > uint8_t modrm, sib, rex, rip; /* the bytes themselves */ > } ea; > ? > > all source file are full of incorrect type and if you harden compilation > flags, you'll see there are lots of warning, potentially due to bad > conception. > What's your opinion? > Note: in the above example using size_t would suck, because size_t is way too big, especially on 64-bit platforms. I *believe* that uint8_t would do just fine. -hpa |