Bounty for -minimal compiler flag

Daniel Murphy yebbliesnospam at gmail.com
Fri Feb 14 07:23:50 PST 2014


"1100110"  wrote in message news:ldl9fj$28g6$1 at digitalmars.com...
> > I don't think it's worth throwing out assert over.  A runtime that
> > supported assert + Object would be about 8 lines and would IMO be
> > worthwhile.
>
> But then where do we stop?
> This is why I think it's an excellent idea to have multiple flags, or 
> options, one for each thing disabled.
>
> So you can only disable what you do not want.

'assert' is pretty fundamental (compared to something like exceptions) and 
is especially important in low-level code.  It can also be disabled 
using -release.

I guess worst case the compiler could inline it as `e || 
_whatever_the_clib_calls_on_assert_failure`

> >
> > This puts us in the nasty situation of having code behave differently
> > with and without the switch.  Like dynamic cast, I'd rather it was a
> > compile-time error and you had to use arr.ptr[0..newlen] instead.
> >
>
> Very Very good point there.  I didn't think about that.  Code should not 
> behave any differently with different switches.  Period.  I seriously 
> doubt it would make it into the repo either.

Hmm, I forgot about new and delete.  They would be nice to have as wrappers 
around malloc, but that would change the meaning of code... 



More information about the Digitalmars-d-announce mailing list