lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fixing compiler warnings


From: Reinhold Kainhofer
Subject: Re: fixing compiler warnings
Date: Mon, 27 Dec 2010 12:51:25 +0100
User-agent: KMail/1.13.5 (Linux/2.6.35-23-generic; KDE/4.5.4; i686; ; )

Am Montag, 27. Dezember 2010, um 08:57:14 schrieb Werner LEMBERG:
> 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.  

It's also not good C++ practice to throw exceptions when a virtual function is 
not overloaded by child classes. The proper thing to force child classes to 
implement a virtual function is to use pure virtual functions, ie. in the 
class definition:

class Font_metric {
...
   virtual get_indexed_char_dimensions (size_t) = 0;
...
};
and no implementation of that function. The compiler will then throw an error 
if a child class does not implement that function.

Cheers,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]