On 11/10/2011 4:53 PM, bearophile wrote:
This is a (minor) wart of D. C# got this better, using the "sbyte" and
"ubyte" names. We have discussed this in past :-)

Sorry, but I think this is meaningless trivia.

There's been a lot of agonizing over names in D lately. They are a soul-sucking quagmire of wasting time.


When I program in D, I take care of keeping often in my mind that "int" is
not an integer number, but a unchecked signed 2-complement 32-bits-wide bit
field. Forgetting it causes several bugs and troubles.

And when you program in floating point, you have to keep in mind the limitations of the exponent and the mantissa.

And when you write a recursive function, you have to be mindful of stack limitations.

There's no escaping what a computer is. In any engineering profession, you've got to keep in mind that your design becomes real parts made out of real materials, and those materials are far from ideal. Forget that at one's peril.

----

This reminds me of the experience of a good friend of mine, very smart, who decided to learn Fortran by reading the DEC Fortran reference manual. He wrote his first program, and it worked perfectly the first time (did I say he was very smart?), except for one detail. It ran incredibly slowly.

He poured over his listing and the manual, and could find nothing wrong. Finally, he took the listing (back in those days, we worked from paper listings) to my roommate and asked for help.

My roommate looked at it and says, there's your problem. You are writing to a file by opening it, appending a single character, then closing it, in a loop. Don't you know you're supposed to open the file once, do all the writes, then close it?

No, says my friend, the manual said nothing about that, although when you think about how the computer must work when writing a file, it is obvious.

Reply via email to