Bad array indexing is considered deadly

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 1 12:48:08 PDT 2017


On 6/1/2017 12:16 PM, Timon Gehr wrote:
> On 01.06.2017 20:37, Walter Bright wrote:
>> It is a programming bug> to not validate the input. It's not that bad to abort 
>> programs if you neglected to validate the input.
>> ...
> 
> It really depends on the specific circumstances.

The stages of programming expertise:

1. newbie - follows the rules because he is told to
2. master - follows the rules because he understands them
3. guru - breaks the rules because he understands the rules don't apply

Let's not skip stages :-)


>> It is always bad to treat programming bugs as input errors.
> They should be treated as bugs, but isn't it plausible that there are 
> circumstances where one does not want to authorize every @safe library function 
> one calls to bring down the entire process?

You, as the programmer, need to decide what is validated data and what is not. 
Being unclear about this is technical debt that is going to cause problems.

Validated data that is not valid is a programming bug and the program should be 
aborted.


More information about the Digitalmars-d mailing list