Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Oct 1999 00:50:01 -0700 (PDT)
From:      "Valentin Nechayev" <nn@nn.kiev.ua>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/14142: sendmail: mci.c: bad pointer conversion in debug print
Message-ID:  <199910060750.AAA35315@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

The following reply was made to PR bin/14142; it has been noted by GNATS.

From: "Valentin Nechayev" <nn@nn.kiev.ua>
To: bde@zeta.org.au
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/14142: sendmail: mci.c: bad pointer conversion in debug
    print
Date: Wed,  6 Oct 1999 10:03:10 +0300 (EDT)

 Bruce Evans <bde@zeta.org.au> wrote:
 
 > On FreeBSD-alpha sizeof(void *) == sizeof(long), so the conversion from
 > void * to u_int is never executed.  Unfortunately, gcc apparently warns
 > about casts from pointers to integers of a different size even in dead
 > code.
 >
 > On FreeBSD_i386-with-64-bit-longs, gcc warns about the dead code in the
 > other arm of the if and about 3 casts from pointers to u_longs.  All these
 > problems can be fixed better now by casting pointers to
 > (u_long)(uintptr_t)(void *) and printing them with %lx, or if the format
 > doesn't matter, by casting pointers to (void *) and printing them with %p.
 
 Well, shall it be better to use only %p and casting to void*, as "the only
 really right and portable way"?
 
 > > These conversions are FreeBSD-specific; original Allman's sendmail
 > > does not contain them.
 >
 > The original code was broken at runtime (it shows only the low 32 bits of
 > pointers on FreeBSD-alpha).
 
 Of course, original code is broken also and really. Do you know the reason
 of using integral formats instead of %p in original code?
 
 
 
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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