The added compatibility between 32 and 64 bit systems, is another reason. Also if you choose int to be 64 bits, what would you make short? 16 or 32 bits? It makes much more sense to keep int 32 bits, and reserve long / long long for 64 bits.
3,279 karma · joined October 26, 2013
The added compatibility between 32 and 64 bit systems, is another reason. Also if you choose int to be 64 bits, what would you make short? 16 or 32 bits? It makes much more sense to keep int 32 bits, and reserve long / long long for 64 bits.
C would probably not have survived unless it had this flexibility.
But its not justa historical thing. Today there are modern platforms like DSPs that have 32bit sized char, because that is the smallest addressable type. These platforms depend on C for tool chains, even if most "portable" C wont run correctly on them. The fact that you can build hardware like that, and not have to invent a new language / dialect to program them is a huge win for the world.
<edit> I didnt see the footnote about DSPs at first read </edit>
A better way to think about UB is as a contract between developer and implementation, so that the implementations can more easily reason about the code. How would you optimize:
(x * 2) / 2
An optimizer can optimize this out for a signed integer, because it doesn't have to consider overflow, but with a unsigned integer it can not. UB is a big reason why C is the most power efficient high level language.
-Denial: "I know what signed overflow does on my machine."
-Anger: "This compiler is trash! why doesn't it just do what I say!?"
-Bargaining: "I'm submitting this proposal to wg14 to fix C..."
-Depression: "Can you rely on C code for anything?"
-Acceptance: "Just dont write UB."
Academia is better at setting clear requirements and measuring those goals, but whether these requirements have anything to do with being successful or useful in the real world is an entirely different matter.
School isn't reality, its mostly not even trying to simulate reality. School breads a lot of "Why was I not rewarded? I did everything they said i should do" disappointment in the real world.
There is a difference between things that are difficult and things that just take a lot of work.
So go ahead, write your own date library, your own Unicode font rendering, compiler, OS, game engine or what ever else people tell you to never do because its hard.
Should we make convictions of murder, depndent on proving that the victim dint actually want to get shot?
You list things that regulated to protect the user of drugs, tobacco and alcohol, but with prostitution, the product is a human being that needs to be protected too.
The Nordic model, does not outlaw selling sex, but criminalizes buying. In my opinion, selling sex may be harmfull, but i see no ethical reason against it. However there is no ethical way to buy sex, because its impossible for a buyer to be sure that you are not causing serious harm to the person you are buying from.
Most of the jobs you list are FAR safer then prostitution. But yes I would argue there are lots of other jobs that i would outlaw for the same reason. Like Bumfighting, a lot of dodgy construction, self harm, jobs without proper safety equipment, gladiators, and a lot of military recruitment. You are exploiting, or are very likely to be exploiting people in dire situations.
"neither harmful", tells me you know nothing about the subject.