Stop using 'short' for line and allocation sizes (2013)
11–20 of 50 posts
Re: Stop using 'short' for line and allocation sizes (2013)
#12Edit: apparently it has no undo. The rules:
1) Linus does not make mistakes
2) In the event of Linus making a mistake, see rule 1
3) ...
4) git reset --hard HEAD
Re: Stop using 'short' for line and allocation sizes (2013)
#13Re: Stop using 'short' for line and allocation sizes (2013)
#14Re: Stop using 'short' for line and allocation sizes (2013)
#15Stupid question: why not unsigned int?
Re: Stop using 'short' for line and allocation sizes (2013)
#16Re: Stop using 'short' for line and allocation sizes (2013)
#17Re: Stop using 'short' for line and allocation sizes (2013)
#18Stupid question: why not unsigned int?
And it will be a bit faster for certain weird architectures since the overflow behavior of an unsigned is prescribed but signed overflow is undefined. But I really doubt anybody cares about that here.
Re: Stop using 'short' for line and allocation sizes (2013)
#19Why not fixed-size ints - uint8_t, etc. from stdint.h? I've not been using C for a while, so I wonder what the viewpoints are regarding this.
I doubt either of these situations come up when dealing with line sizes in a text editor.
Re: Stop using 'short' for line and allocation sizes (2013)
#20Why not fixed-size ints - uint8_t, etc. from stdint.h? I've not been using C for a while, so I wonder what the viewpoints are regarding this.
off_t for file offsets
ptrdiff_t for memory offsets (vs. size_t for unsigned)
int for return flags
A problem with this is that printf does not have sizes to match these.