From owner-cvs-all Sat Aug 15 16:06:42 1998 Return-Path: Received: (from daemon@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA28583 for cvs-all-outgoing; Sat, 15 Aug 1998 16:06:42 -0700 (PDT) (envelope-from owner-cvs-all) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA28577; Sat, 15 Aug 1998 16:06:41 -0700 (PDT) (envelope-from bde@FreeBSD.org) From: Bruce Evans Received: (from bde@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id QAA22280; Sat, 15 Aug 1998 16:06:38 -0700 (PDT) Date: Sat, 15 Aug 1998 16:06:38 -0700 (PDT) Message-Id: <199808152306.QAA22280@freefall.freebsd.org> To: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: cvs commit: src/sys/scsi ch.c Sender: owner-cvs-all@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk bde 1998/08/15 16:06:38 PDT Modified files: sys/scsi ch.c Log: 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. Revision Changes Path 1.48 +5 -4 src/sys/scsi/ch.c