M
Malcolm
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
than that is "haraba".
your programs efficiently. Of course the nasty money men who run his company
are trying to screw money out of the nasty money men who run yours, but that
hardly affects people like us.
bytes in the computer, then I would be annoyed.
that an integer can count anything, then it is responsibility of the
compiler maker to make sure it can count anything, or at least anything that
is likely to crop up on that machine - you may have a company with over
32000 employees, for example, but it is not going to try to run its payroll
on a machine with 16-bit registers.
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
My programmers are bunny rabbits. They only count to five. Anything biggerStephen Sprunk said:You mean an integer which is not required to hold values outside the
range -32767 to 32767, and which is probably the fastest integer type.
than that is "haraba".
The nice engineer, believe me, wants you to have a machine that will runWhat the manufacturer wants has nothing to do with what I want or what the
compiler writers want. I want my code to (1) work, and (2) run as fast as
possible. The manufacturer wants to extract money from my wallet. There
are no shortage of cases where 32-bit ints are faster than 64-bit types on
a processor that "kindly provided 64 bit registers."
your programs efficiently. Of course the nasty money men who run his company
are trying to screw money out of the nasty money men who run yours, but that
hardly affects people like us.
You see I just want an integer. Integers count things. If it can't count theIf I need an integer with at least 64 bits, I'll use long long; if I want
a fast integer, I'll use int; if I want a fast integer with at least 32
bits, I'll use long. They may not be the same size, and it's up to the
compiler folks to pick which combination is best for a given platform.
bytes in the computer, then I would be annoyed.
As long as your assumption that 32 bits is enough is accurate. If you assumeAnd such weird and wonderful things are allowed by the standard, because
they existed prior to its creation and the purpose of ANSI C was, for the
most part, to document what existed and not to create an ideal language.
You can assume int or long (or long long) is good enough, and in most
cases you'll be right, but that non-portable assumption will eventually
come crashing down -- typically while you're doing a demo for a customer,
or years after the original coder left and you're stuck with maintaining
his crap. Use size_t and you'll never need to worry about it. Thanks,
ANSI.
that an integer can count anything, then it is responsibility of the
compiler maker to make sure it can count anything, or at least anything that
is likely to crop up on that machine - you may have a company with over
32000 employees, for example, but it is not going to try to run its payroll
on a machine with 16-bit registers.