problem with size_t and an easy solution

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


On Mon, 08 Dec 2014 15:05:18 +0000
Jonathan Marler via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> What about 'usize' and 'ptrdiff' ?
`sptrdiff`, as i did it in my branch. `ssize` was just an example, i
don't like it too. yet `sptrdiff` is still ugly. why 'ptr', what it has
to do with pointers at all? why, for example, `indexOf()` returns
`ptrdiff_t`? btw, this is a bug, 'cause that means that i can't search
more than 2GB in 32-bit and get a sane result on hit, for example.

something like 'ssizediff' is slightly better, i think. we have no
explicit "ptr" type, and using `ptrdiff_t` when subtracting pointers
is wrong anyway (only `uptrdiff_t` can do there, but we already has
`usize` for it).

or, doing it *right* this time: just annihilate `ptrdiff_t`. it's
dangerous and useless.
-------------- 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/20141209/a334c113/attachment.sig>


More information about the Digitalmars-d mailing list