spir wrote: > On 02/15/2011 02:01 PM, Daniel Gibson wrote: > >Am 15.02.2011 12:50, schrieb spir: > >>On 02/15/2011 03:44 AM, Piotr Szturmaj wrote: > >>>spir wrote: > >>>>Rename size-t, or rather introduce a meaningful standard alias? (would > >>>>vote for Natural) > >>> > >>>Maybe ptrint and ptruint? > >> > >>If ptr means pointer, then it's wrong: size-t is used for more than > >>that, I guess. Strangely enough, while "size" may suggest it, .length > >>does not return a size_t but an uint. > >> > >>Denis > > > >.length of what? An array? > >I'm pretty sure it returns size_t. > > unittest { > int[] ints; auto l = ints.length; > writeln(typeof(l).stringof); > } > press play ;-)
I do not get it. The above returns uint which is fine because my dmd v2.051 is 32-bit only. I.e. size_t is an alias to uint (see src/druntime/src/object_.d lin 52). But somehow I think you are implying it does not return size_t. This is right in the sense that it does not return the alias name size_t but it returns the aliased type name, namely uint. What's the problem? This writeln(size_t.stringof); also returns uint. I read that the compiler is free to return whatever name of an alias, i.e. either the name of the alias or the name of the thing it was aliased to (which can be again an alias). I do not understand the rule for stringof (reading http://www.digitalmars.com/d/2.0/property.html#stringof) but I never had a problem. Jens