Martin Uecker <[email protected]> writes:

> What I find unlucky, for example, is that we do have a generic
> tree data structure with a lot of imlicit assumptions and lot
> of issues if those are violated. So encapsulating this properly
> in abstract data types would be really helpful.  But we could do
> this also in C, while the switch to C++ apparently did nothing
> to address this.

Indeed, adding '-x c++' doesn't automatically fix existing code.

However, C++ enables other things to be done here.  For instance, at
one of the Office Hours, a mechanism for encoding tree types (without
requiring rewriting massive amounts of code) was proposed.  It relied on
templates, and it compiles down to the same code as today, and can
provide a bridge for existing code.  Essentially, it allowed us to
specify types such as 'ttree<one_of<PLUS_EXPR, MINUS_EXPR>>' or such,
and could automatically insert (and elide) gcc_asserts that check for
those tree codes.

I don't recall who proposed it or if it ever was sent, but a similar
thing wouldn't be possible in C.

It looked like something I sketched at one point, but I never finished
the implementation, unfortunately, so there's nothing for me to share.
Apologies.
-- 
Arsen Arsenović

Attachment: signature.asc
Description: PGP signature

Reply via email to