-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Hi,
I just found a very shocking news in the documentation regarding default-constructor:
A default-constructed Quantity is initialized to some value, which helps avoid certain kinds of memory safety bugs. However, the value is contractually unspecified. You can of course look up that value by reading the source code, but we may change it in the future, and we would not consider this to be a breaking change. The only valid operation on a default-constructed Quantity is to assign to it later on.
This behaviour would differ from the underlying native type like double, int etc. which is contra-intuitive and thus error-prone!
We are using the default-constructor spread in our entire code base, with the assumption, that the default value equals to the default value of the native underlying type!
You cannot expect that users read every single line in your documentation. And even if I know this now, my collegues in my company still don't know this and it is hard to communicate this problem to every developer in a big company.
Documentating it, doesn't solve the problem, as I said: You must never expect, that user are reading carefully every single line of your documentation. I experience myself, that many collegues simply don't read my documentation and they expect, that everything works like they expect it intuitively.