problem with size_t and an easy solution

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 9 00:26:18 PST 2014


On Tuesday, 9 December 2014 at 03:48:17 UTC, ketmar via 
Digitalmars-d wrote:
> i can remember that too, but i prefer to have the things that i 
> can
> logically deduce. i can deduce `usize`: "ah, it's size. and it's
> unsigned. D tends to add 'u' for unsigned types and naming 
> 'size' as
> 'size' is logical. so it must be 'usize'. hit!"

Size is unsigned for being positive. Why emphasize it again? 'u' 
prefix is for general purpose integers, size_t is a special 
purpose type for specific case of representing sizes, similar 
types are time_t, off_t and hash_t in a sense that representation 
can change, but purpose will remain the same.


More information about the Digitalmars-d mailing list