top | item 9989935

(no title)

ahomescu1 | 10 years ago

size_t is also unsigned (no idea why). The signed equivalent is ssize_t.

Edit: Sorry, missed the "i-- > 0" at first. The code works, but not because of changing "unsigned" to "size_t".

discuss

order

Peaker|10 years ago

Sizes can be >2gb on a 32 bit system. Not sure how ssize_t works, is it 64 bits then?

It makes sense to use unsigned for sizes to save a bit (or 32 bits per size). Also less invalid possible inputs to handle.

kazinator|10 years ago

By the way, ssize_t is POSIX, from <sys/types.h>, not ISO C.

MaulingMonkey|10 years ago

No worries. I nearly left it "unsigned", but my OCD kicked in. Too many 64-bit conversion warnings stain my psyche...