Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Aug 1998 16:06:38 -0700 (PDT)
From:      Bruce Evans <bde@FreeBSD.ORG>
To:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   cvs commit: src/sys/scsi ch.c
Message-ID:  <199808152306.QAA22280@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808152306.QAA22280>