> From: Giovanni Bajo <[EMAIL PROTECTED]>
>> Diego Novillo <[EMAIL PROTECTED]> wrote:
>>> There has been some opposition in the past about allowing conditions in
>>> asserts to be used as hints to the optimizers. In fact, I would like to
>>> know if there is a current statement of purpose about this. That is,
> would
>>> there be strong oppositions to patches doing this?
>>> 
>> VRP naturally takes advantage of assert (though not in some
>> occassions involving unsigned types).  Try:
>> 
>> #include <assert.h>
>> 
>> foo (int i)
>> {
>>   assert (i != 0);
>>   if (i == 0)
>>     return 3;
>> 
>>   return 2;
>> }
> 
> Agreed, but my point is whether we can do that when NDEBUG is defined.

Might be nice to have both flavors, or take a parameter which indicates
if it's meant to be a static assertion, or throw a named runtime exception;
where the static assertion inhibit code generation simply inhibits code
generation somehow? as their requirement is not mutually exclusive.




Reply via email to