[PATCH][C++] Get rid of TREE_CHAIN use for TREE_VEC (NON_DEFAULT_TEMPLATE_ARGS_COUNT)

Gabriel Dos Reis gdr@integrable-solutions.net
Fri Aug 17 19:11:00 GMT 2012


On Fri, Aug 17, 2012 at 1:03 PM, Mike Stump <mikestump@comcast.net> wrote:
> On Aug 17, 2012, at 6:58 AM, Paolo Carlini wrote:
>> On 08/17/2012 01:26 PM, Richard Guenther wrote:
>>> This gets rid of this field, pushing it into a short int in tree_base
>>> (hopefully 2^16 non-defaulted template args are enough ...).
>> Honestly, I don't think it's a trivial issue.
>
> Love to hear from Jason, but, my take would be 2^16 should be enough for anyone.  I think long before people hit that limit, they would merely aggregate arguments into classes and structures.  I think in another 20-80 years, we might want to bump it back up to 32 bits, but...  I think we can safely wait until we get a compelling bug report for it.

C++11 says that an implementation should be able to handle at least 2^10
template parameters, 2^12 members declared in a single class.  I believe
that even for automatically generated programs, 2^16 is a good limit.  I suspect
that by the time that limit is a hindrance, C++ would have gone through several
iterations and more importantly 128-bit integers would be common place, so
by that time we would have plenty of spare bits -- if we haven't already
restructured the tree data structures to use idiomatic C++ constructs that
are both more space and time efficient.

This is a very long of saying "I am comfortable with the 2^16 restriction
on the number of template parameters.  The patch needs to document
that in the usual .texi file."

-- Gaby



More information about the Gcc-patches mailing list