Hey,

Thorsten Glaser <[email protected]> wrote:
 |Just a short note…
 |
 |./lalloc.c:#define ALLOC_ISUNALIGNED(p) (((ptrdiff_t)(p)) % ALLOC_SIZE)
 |./lalloc.c:     if (ALLOC_ISUNALIGNED(ptr))
 |./lalloc.c:         || ALLOC_ISUNALIGNED(lp)
 |
 |… and…
 |
 |./histrap.c:            if ((ptrdiff_t)hp < (ptrdiff_t)history) {
 |./histrap.c:            } else if ((ptrdiff_t)hp > (ptrdiff_t)histptr) {
 |
 |… these are probably not safe. Hell, any signed types
 |are probably not safe, in C, unless proven otherwise.
 |
 |mksh probably should not use ptrdiff_t a̲t̲ ̲a̲l̲l̲, just size_t.

Even better is probably uintptr_t (falling back to size_t falling
back to unsigned long)?

 |Discovered by the size_t/ptrdiff_t asymmetry on s390 being
 |discussed in various places.
 |
 |bye,
 |//mirabilos
 |-- 
 |[16:04:33] bkix: "veni vidi violini"
 |[16:04:45] bkix: "ich kam, sah und vergeigte"...

--steffen

Reply via email to