This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: throw(), pure and const flags on functions


Gabriel Dos Reis wrote:

> However, the argument of people worrying about code size of
> tiny embedded systems but not using -Os looks a bit curious
> to me.

-Os does lots of optimizations -- including optimizations that interfere
with debugging.  -O0 does not.  Users need to be able to debug their
code.  Hence, it is helpful to generate small code with -O0, to the
extent that isn't very expensive in the compiler, and doesn't interfere
with debugging.

-Os is what you would use for final code deployment.  But, it's good if
-O0 is small, too.

>> think we should add them to declarations of functions that cannot throw
>> exceptions, if those functions call only other functions that do not
>> throw exceptions, and if that improves the code generated at any level
>> of optimization.  I think we should have compiler warnings to help with
>> this: both a warning that a function could safely be declared as
>> "throw()", and a warning that a function declared "throw()" calls
>> functions that themselves appear capable of throwing exceptions.

> If we start warning about absence of 'throw()', the net effect
> is that people would start putting those stuff almost everywhere.
> and I think the cure might be worse than the desease.

I didn't say these warnings should be on by default.  They would be
there for the benefit of those building libraries, and wanting to
squeeze the last bits of space out of them.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]