[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fixing compiler warnings
From: |
Werner LEMBERG |
Subject: |
Re: fixing compiler warnings |
Date: |
Mon, 27 Dec 2010 08:57:14 +0100 (CET) |
>>> Are you certain that this is a good change:
>>
>>> +Font_metric::get_indexed_char_dimensions (size_t) const
>>> {
>>> return Box (Interval (0, 0), Interval (0, 0));
>>> }
>>
>> Yes, as Han-Wen already mentioned. Derived classes must provide
>> something useful.
>
> If they must, wouldn't it be saner to throw an exception here
> instead of returning nonsense?
I don't have too much experience with C++ code, however, being the
maintainer of groff, I have studied groff's code a lot, and no, it is
not common to throw exceptions. Instead, most virtual methods return
a `sane' value (more or less) which is acceptable for further
processing. In the code snippet above, get_indexed_char_dimensions
returns a box with zero dimensions, which is sensible output IMHO.
Werner