This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: [tree-ssa] Statement with no effect warning


> On Tue, 2003-12-16 at 13:59, Geoff Keating wrote:
> 
> > Can we fix this?  It would be better if it was impossible to write
> > code that will build on a compiler with checking enabled but won't
> > build on a compiler with checking disabled.
> >
> Contrived, but shows one recent example:
> 
> foo(int a, int n)
> {
>    int m = a;
> 
> #if defined ENABLE_CHECKING
>    if (m == 0)
>      abort ();
> #endif

These examples would be solvable by using assert instead of if...abort
checking.  I would quite preffer assert in these cases as it also makes
runtime messages more readable and the is less intrusive to non-checking
control flow, but I know it is not popular in GCC even when I don't
recall why.

Honza
> 
>   return n / a;
> }


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