help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison 3.6 requires runtime type information?


From: Akim Demaille
Subject: Re: Bison 3.6 requires runtime type information?
Date: Sat, 27 Jun 2020 17:09:21 +0200

Adrian,

> Le 27 juin 2020 à 13:39, Adrian <withoutpointk@gmail.com> a écrit :
> 
> Hi Akim,
> 
> It would be nice if it were possible to enable parse.assert without rtti,
> but I understand if it's difficult/impossible and that it's a very
> minor use case.
> However, just for discussion, if I understood the docs bison's variant
> does not store a type tag
> because it already knows what type the semantic value is?

Correct.

> And I'm guessing it does so for assert, using rtti?

Correct.

> If so, it should be possible to implement the tagging without rtti,
> the way c++17's variant works.
> I believe the standard library variant does something like defining a
> templated function for each variant type,
> so each address of this templated function corresponds 1-1 with one of
> the variant types,
> and can be used to store/check the type.

I see the idea.

> I believe that a new function is not even necessary;
> the address of the "as" method on bison's variant satisfies the requirements
> (but maybe depending on an existing function with another purpose is
> not a good idea).
> If this (removing rtti dependency for parse.assert) is something you'd
> be interested in,
> I may give making a patch a shot sometime in the future.

If it's short and portable (C++98), why not.  But I'm not looking for extra
complexity.  Using RTTI in debug mode seems ok to me, that's a good
compromise.

Cheers!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]