Re: Transitioning libgomp from C to C++ implementation

"Arsen Arsenović" <[email protected]>
Newsgroups gmane.comp.gcc.devel
Organization BayLibre
Message-ID <[email protected]>
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ć
signature.asc (application/pgp-signature, 288 B)
-----BEGIN PGP SIGNATURE-----

iKIEARYKAEoWIQT+4rPRE/wAoxYtYGFSwpQwHqLEkwUCaf75gRsUgAAAAAAEAA5t
YW51MiwyLjUrMS4xMiwyLDIQHGFyc2VuQGFhcnNlbi5tZQAKCRBSwpQwHqLEkzPN
AP0Y1bE86TionsfYBXor0fRYUsAAuDVpfFkzqafDWc09WwD9GbEq5jDl92TfiwKL
AB8FyjgzgY/DZT34gLTA3yVQDAs=
=Qd/9
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.