[cfe-dev] bug with USRs and fixed-length arrays?

Dmitri Gribenko gribozavr at gmail.com
Fri Nov 2 12:55:14 PDT 2012


On Fri, Nov 2, 2012 at 9:37 PM, Iestyn Bleasdale-Shepherd
<iestyn at valvesoftware.com> wrote:
> Ah, you are right! There is an extra ingredient in our usage cases:
> templates*
>
> For example, we use templates to implement ‘safe’ string functions which use
> the type of the destination buffer (a fixed-length character array) as the
> template parameter, rather than passing in the array size as a function
> parameter (which is error-prone – array size sometimes being confused with
> array length, for multi-byte characters).
>
> However, here are the USRs that I get in a templatized example case:
>
> template <class buffer> void mystrlwr( buffer &dst );                     //
> c:@FT@>1#Tmystrlwr#&t0.0#
>
> template <> void mystrlwr<char[16]>( char (&dst)[16] );
> // c:@F at mystrlwr<# >#&S0_#
>
> template <> void mystrlwr<char[32]>( char (&dst)[32] );
> // c:@F at mystrlwr<# >#&S0_#
>
> template <> void mystrlwr<char[64]>( char (&dst)[64] );
> // c:@F at mystrlwr<# >#&S0_#
>
> Here, the type buffer type gets reduced to “ “ as a template parameter and
> “S0_” as a function parameter.

I see.  This was actually discussed previously:

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-August/023628.html

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-dev mailing list