problem with size_t and an easy solution

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 8 06:31:40 PST 2014


On Mon, 08 Dec 2014 13:49:30 +0000
Ivan Kazmenko via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> On Monday, 8 December 2014 at 08:46:49 UTC, bearophile wrote:
> > Freddy:
> >
> >> Why not keep size_t implictly convertable but disallow it for
> >> usize.
> >
> > This is an interesting idea. (But the name "uword" seems 
> > better).
> 
> The char, wchar (word char) and dchar (double word char) types 
> seem to disagree.  The "word=2bytes" historical rule is rooted 
> too deeply.  An "uword" will also be very confusing alongside 
> lower level code (e.g. assembler).
> 
> Personally, when I face the need for a size_t, I usually can (and 
> do) use auto instead.  And even if I have to spell it, I don't 
> care too much how it's called, only whether it can be easily 
> recognized.
i bet that "woobooAAARGH" will be even easier to recognize than
"size_t". as there is no other types in D with "_t" suffix, you have to
remember that anyway, so it doesn't really matter which one to
remember. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141208/a4184ef0/attachment.sig>


More information about the Digitalmars-d mailing list