Boost logo

Boost :

From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-05-30 15:09:36


From: "Douglas Gregor"

> We probably shouldn't use the word "redefinition" because it isn't
redefining
> but instead adding new productions.

Agreed. It isn't.

> Say we have some small language ...snip]
>

> Then when the compiler is in strict standard-conforming mode, the grammar
> only contains those productions allowed by the standard. If extensions are
> enabled, the productions are in the grammar. This determination is made at
> runtime so it is suitable for a command-line switch.

Now I understand.

>
> > Nevertheless, I wasn't quite accurate. There's no runtime
> > penalty. But there sure is code-size penalty even if you
> > don't use the feature.
> >
> > Joel de Guzman
>
> I (obviously) think it's worth the penalty, but more input is nearly
always a
> Good Thing.
>
> Doug
>

If we did it George Heintzelman's way, |= instead of = for new productions,
we don't have to pay for the feature if we don't use it. The penalty is the
added code to the = operator. If we let that as is (no redefines) and
use the |= for new productions (alternatives), then we have a win-win
situation: no penalty if the feature is not used and clarity in the
imperative
perspective.

a = b;
a |= c;
a |= d;
if (flag) a |= e;

Sounds cool.
Joel de Guzman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk