Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15652 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1489 invoked by uid 1010); 29 Mar 2005 11:35:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1474 invoked from network); 29 Mar 2005 11:35:36 -0000 Received: from unknown (HELO yahoo.co.kr) (127.0.0.1) by localhost with SMTP; 29 Mar 2005 11:35:36 -0000 X-Host-Fingerprint: 62.245.70.224 r2g224.chello.upc.cz FreeBSD 4.6-4.9 Received: from ([62.245.70.224:2743] helo=isis.sigpipe.cz) by pb1.pair.com (ecelerity HEAD r(5268)) with SMTP id 00/E6-10638-78D39424 for ; Tue, 29 Mar 2005 06:35:35 -0500 Received: by isis.sigpipe.cz (Postfix, from userid 1001) id 466C31F87BEE; Tue, 29 Mar 2005 13:35:32 +0200 (CEST) Date: Tue, 29 Mar 2005 13:35:32 +0200 To: Derick Rethans Cc: internals@lists.php.net Message-ID: <20050329113532.GA42955@isis.sigpipe.cz> References: <20050326235844.GA6613@isis.sigpipe.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i Subject: Re: [PHP-DEV] snprintf / ap_php_snprintf, %lld, gcc versions? From: neuhauser@sigpipe.cz (Roman Neuhauser) # derick@php.net / 2005-03-27 07:49:31 +0200: > On Sun, 27 Mar 2005, Roman Neuhauser wrote: > > I'm having a puzzling problem with %lld conversion handling > > in ap_php_snprintf, and it seems to be gcc version-dependent. > > > > I found this problem through Statgrab, which has this macro: > > > > #define PHP_SG_ADD_LLVAL(rtz, key, val) { \ > > char tmp[256]; \ > > int tmp_len = snprintf((char *)&tmp, sizeof(tmp) - 1, "%lld", val); \ > > add_assoc_stringl_ex(rtz, key, sizeof(key), tmp, tmp_len, 1); \ > > } > > > > main/snprintf.[hc]: > > > > #define snprintf ap_php_snprintf > > PHPAPI int ap_php_snprintf(char *buf, size_t len, const char *format,...) > > For some reason the header file is not included then - that should be > fixed as our own (ap_php_snprintf) function should always be used which > is not gcc dependent. Turns out you are right, but probably not the way you expected: %lld is broken on the boxes where snprintf expands to %ap_php_snprintf(). The difference is in the installed include/php/main/snprintf.h file (present vs. missing HAVE_SNPRINTF check), at least between a pair of hosts I'm looking at right now. So now the question is: what is the best (least intrusive) way to make sure the system snprintf is used? #if 0 the snprintf macro? BTW, perhaps the unconditional ap_php_snprintf use could be backed out until the function is mature enough to actually be an improvement? See also http://marc.theaimsgroup.com/?l=php-dev&m=110746124520191&w=2 -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991