The Right Approach to Exceptions

deadalnix deadalnix at gmail.com
Sun Feb 19 04:20:19 PST 2012


Le 19/02/2012 04:31, Walter Bright a écrit :
> On 2/18/2012 3:13 PM, Andrei Alexandrescu wrote:
>> On 2/18/12 4:26 PM, Jonathan M Davis wrote (abridged):
>> GetOptException
>> FlagArgumentMissingException
>> InvalidFlagArgumentException
>> UnknownFlagException
>> FileException
>> FileNotFoundException
>> NotFileException
>> NotDirException
>> AccessDeniedException
>>
>> I died inside a little.
>
> I think typed exceptions are a good idea, but something looks wrong with
> these.
>
> (Also, having a large number of exception types is going to produce a
> lot of program size bloat. Remember, for EVERY class type, you've got
> the vtbl[], the .init data, and the TypeInfo. Going to town on exception
> types can really add this up.)

Why is the executable size such a big issue ?

Additionnaly, nto providing a convenient Exception hierarchy is going 
inveitably to lead lib devs to create theire own. And the bloat will be 
even bigger (due to redundancy) and the result less convenient because 
the result will be inconsistent for the user of theses libs.


More information about the Digitalmars-d mailing list