| www.delorie.com/archives/browse.cgi | search |
| Date: | Sun, 1 Aug 1999 11:49:06 +0300 (IDT) |
| From: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> |
| X-Sender: | eliz AT is |
| To: | pavenis AT lanet DOT lv |
| cc: | djgpp-workers AT delorie DOT com, DJ Delorie <dj AT delorie DOT com> |
| Subject: | Re: sscanf() format %p seems to be broken |
| In-Reply-To: | <B0000096582@stargate.astr.lu.lv> |
| Message-ID: | <Pine.SUN.3.91.990801114824.20304X-100000@is> |
| MIME-Version: | 1.0 |
| Reply-To: | djgpp-workers AT delorie DOT com |
| X-Mailing-List: | djgpp-workers AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
On Sat, 31 Jul 1999 pavenis AT lanet DOT lv wrote:
> #include <stdio.h>
>
> main()
> {
> char buf[64];
> char *p = buf, *q = NULL;
> sprintf(buf, "%p", p);
> sscanf(buf, "%p", &q);
> exit (p != q);
> }
That's because _doscan doesn't use 16 as conversion base with %p, and
_doprnt doesn't produce the leading 0x when passed %p as the format.
DJ, is it a good idea to have %p imply the base of 16 in doscan.c?
Since %p is non-ANSI, I guess we could do this if we document it, no?
FWIW, it seems that this problem was in doscan.c from day one.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |