This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][C++] Get rid of TREE_CHAIN use for TREE_VEC (NON_DEFAULT_TEMPLATE_ARGS_COUNT)
On Fri, Aug 17, 2012 at 9:11 PM, Gabriel Dos Reis
<gdr@integrable-solutions.net> wrote:
> 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."
I searched for a place where we document GNU C++ implmenetation
defined behavior / limits
but didn't find it. Can you point me to the place where we document
that the current
limit is 2^31 - 1 _non defaulted_ template parameters? (It looks to
me this whole
non-defaulted-template-args stuff was just invented to avoid
pretty-printing defaulted args,
so it does not in any way present an implementation limit but only a
possible bug in that
we'd never pretty-print more than 2^31 - 1 non-defaulted template
paramters in a diagnostic,
but who wants to see 2^31 template parameters in a diagnostic anyways ...)
Richard.
> -- Gaby