diff options
author | bde <bde@FreeBSD.org> | 1998-08-15 23:06:38 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-08-15 23:06:38 +0000 |
commit | c96f169902b2f0814f47953253986e524b1139f3 (patch) | |
tree | fd1edc77fdc3a74eab6143c17dc6b232c3a1aa31 /sys/compat/linux/linux_misc.c | |
parent | a1f9eb2f926345f381c5c3a67c79d747f93720c6 (diff) | |
download | FreeBSD-src-c96f169902b2f0814f47953253986e524b1139f3.zip FreeBSD-src-c96f169902b2f0814f47953253986e524b1139f3.tar.gz |
Cast to `char *' instead of to u_long to help add byte offsets to
pointers. Neither is portable, but "correct" casts to integral
types are much uglier - they lead to expressions like
ptr = (struct struct_with_too_long_a_name *)(void *)(uintptr_t)
((uintptr_t)(void *)ptr + offset);
Here the cast to the struct pointer is to match the surrounding
style of this file (and not depend on C's feature of properly
converting `void *' on assignment or cast), the `void *' casts are
because uintptr_t is only specified to work on `void *' pointers
(I missed this in about 100 lines of previous changes from [u]long
to [u]intptr_t), the outer cast to a uintptr_t is in case the
addition promoted the type, and the inner cast to a uintptr_t
corresponds to the one cast to an integer in the original code.
Don't depend on gcc's feature of casting lvalues.
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
0 files changed, 0 insertions, 0 deletions