List of Phobos functions that allocate memory?

Dicebot public at dicebot.lv
Fri Feb 7 06:42:17 PST 2014


On Friday, 7 February 2014 at 14:26:48 UTC, Marc Schütz wrote:
> Hmm... then what _does_ qualify as exceptional in your opinion?
>
> A logic error (i.e. a mistake on the programmers side) doesn't, 
> IMO, it should abort instead. On the other hand, there is the 
> class of situations where e.g. a system call returns an error 
> (say, "permission denied" when opening a file, or out of disk 
> space). Or more generally, an external service, like a database 
> or a remote server. However, I can't see how these are 
> fundamentally different from invalid user input, and indeed, 
> there's often not even a clear separation, e.g. when a user 
> asked you to read a file they don't have access to.
>
> So, what's left then?

It is exceptional situation if input is supposed to be valid but 
surprisingly is not. For example, calling `decodeGrapheme` on 
external string without making sure it is valid first. Same goes 
for file - trying open a missing file is exceptional, but 
checking for file presence is not.


More information about the Digitalmars-d mailing list