Exception style

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 25 02:54:14 PDT 2014


Sean Campbell:

> but which one is better conforms to the d style?

Both are valid. Use the second when you want a more precise 
exception in your code, this is common in larger programs.

Keep in mind that you can allocate an exception in a point and 
throw it in another. This reduces the runtime allocations and 
should allow more @nogc code.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list