delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/06/17/08:15:37

Date: Wed, 17 Jun 1998 08:15:34 -0400 (EDT)
Message-Id: <199806171215.IAA09961@delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: mdruiter AT cs DOT vu DOT nl
CC: djgpp-workers AT delorie DOT com
In-reply-to: <m0ymH42-000C5CC@sloep111.cs.vu.nl> (message from Michel de
Ruiter on Wed, 17 Jun 98 14:11:42 MET DST)
Subject: Re: rewind and 2.02 alpha

>   printf("p = 0x%08p\n", p);
> testit.c:14: warning: flag `0' used with type `p'

Common practice or not, it's wrong.  You aren't allowed to specify
leading zeros for pointers.  Consider the Borland %p format case:

	0x1234

What would the leading zero do?  000x1234?

Note: in your case, the final result would probably be 0x0x00001234

When using %p, you should either use %p as-is, or at most use %8p, but
not 0x%p or 0x%08p or %08p, because you are assuming something about
the printf formatting that you shouldn't.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019