2 ms·
> The integer types may look similar but they're different in more ways than they're similar. They have different bit sizes, different signedness. The CPU liter
by pcwalton 12y ago
> The integer types may look similar but they're different in more ways than they're similar. They have different bit sizes, different signedness. The CPU literally has to do different things depending if its `uint8` or `int64`. So why do you want or expect one piece of code that does it all?
> It's just so much easier and faster to do it like Go
Would you say the same thing about registers versus stack-allocated memory? ISAs treat registers and stack-allocated memory very differently, yet virtually nobody wants the "register" keyword in C back and nobody is asking for a similar keyword in Go. (In fact, Go even abstracts over heap memory in the same way.)
"The CPU does it differently" is not a valid argument per se against abstraction.
- shurcooL 12y agoYou're right. I should rephrase, I meant that in this case I see the abstraction not being worthwhile because it doesn't save enough time compared to not using it.
- ulber 12y agoThe cost of the abstraction is language dependent though and the programmer might desire the abstraction to be worth it. For example, this particular abstraction is much cheaper in C++ which is a (admittedly small) point in C++'s favor.