Sujet : Re: Loops (was Re: do { quit; } else { })
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 17. Apr 2025, 21:44:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vtrp6t$1dq55$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Mozilla Thunderbird
On 17/04/2025 20:55, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
Here's what you wrote upthread:
What's far more useful is that it naturally works with i64 so has
limits 4 billion times bigger than you get with C's default 'int'
type.
Here's what you could have written:
What's far more useful is that it naturally works with i64 so has
limits 4 billion times bigger than you get with 32-bit int.
That's clearer, shorter, and correct, and would have avoided this
entire subthread. I would not have commented on it.
But it misses out the important bit. Clearly i64 has 2**32 times the range of i32; that will be the case in any context.
What's relevant here is that my language's "don't care" 'int' type defaults to 64 bits, while C's 'int' type, on pretty much any PC from this century, will default to 32 bits.
Which means people are more likely to encounter problems involving wrap, or UB.
Whether C's 'int' should have moved to 64 bits on 64-bit machines has been discussed here in the past.
That would have kicked such problems a /long/ way down the road.