[Development] What kind of airplane we want to build?

Marc Mutz marc.mutz at kdab.com
Fri Jan 22 11:59:40 CET 2016

On Friday 22 January 2016 10:38:28 Welbourne Edward wrote:
> > AFAIK C++11/14 compilers have zero-cost exception, so, is there any
> > reason why not start using them in Qt 6.0 ?
> Any "zero cost" claim is with respect to some assumed base-point.  ISTR
> exceptions require RTTI (run-time type info, as used by dynamic_cast<>),
> so I guess this "zero cost" claim takes for granted the cost of RTTI -
> which is surely non-trivial.  Qt has its own meta-info so (IIUC) can be
> built without RTTI, so building with would be a non-trivial cost as a
> pre-requisite of exceptions.

It's not just RTTI. It's also exception tables and cleanup code.

So no, exceptions don't have zero cost. But they may have zero _runtime_ cost 
when not thrown, as MS claims for the Windows ABI on AMD64.

A fair comparision would, however, not compare -fexceptions vs -fno-
exceptions, but take a subsystem, and replace all manual error handling with 
exceptions, then compare performance and code size between the subsystem using 
exceptions and the version with manual error handling (as complete as 
possible, of course) and -fno-exceptions.

I'm not sure about what outcome to expect, and I don't remember any numbers 
posted by anyone else, either.


Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts

More information about the Development mailing list