On Tue, Feb 25, 2020 at 08:56:06AM +0100, zeurk...@volny.cz wrote: > Haai, > > The definition of size_t keeps biting me. > > Some background: in nnx, me's been using the equiv of caddr_t for > counts. This works well; yet, while writing against existing code that > uses size_t, an issue has surfaced. > > First of all, let us reflect upon the definition of size_t in C99. > > > size_t > > which is the unsigned integer type of the result of the sizeof > > operator; > > That's not very specific. It kind-of implies that SIZE_MAX (defined > later in the standard) is the largest possible offset, but not > necessarily the largest possible address. This reeks of i86 real mode > semantics, obsolete (for general-purpose machines) already when the > PDP-11 was new. > > POSIX is even less helpful: > > > size_t > > Used for sizes of objects. > > (Let me note in passing that medisapproves of the significant overlap > between C99 and POSIX, and the shameless disregard, in both, of the > byte-oriented nature of UNIX and C).
You're looking at the wrong type. size_t is very good for what it does. Try uintptr_t