Datatypes: To be “0″ or not to be “0″…

Argh… how much time (and money) is wasted every year by bugfixing problems caused when a variable becomes zero although there is not much sense for the variable to become zero within the actual context of the program and therefore the programmer missed to add a line for checking this unexpected behavior.

The most common example for this might be if a for-loop will start at zero or one.

I really ask myself if it would be worth creating a new datatype “unsignedNotZero” which can not be set to zero and letting the compiler do most of the checking for me?! Suggestions?

Recent Entries

One Response to “Datatypes: To be “0″ or not to be “0″…”

  1. namenlos Says:

    Schau dir mal Adas Positive an. Mittels bereichsgeprüfter Subtypes kannst du da sogar jeden beliebigen Bereich vorgeben…

    [Reply]

Leave a Reply

Enter this code