From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2327 invoked by alias); 1 Oct 2012 17:32:46 -0000 Received: (qmail 2311 invoked by uid 22791); 1 Oct 2012 17:32:45 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout22.012.net.il (HELO mtaout22.012.net.il) (80.179.55.172) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Oct 2012 17:32:33 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MB800I005YC8L00@a-mtaout22.012.net.il> for gdb@sourceware.org; Mon, 01 Oct 2012 19:31:56 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MB800H00615Y260@a-mtaout22.012.net.il>; Mon, 01 Oct 2012 19:31:54 +0200 (IST) Date: Mon, 01 Oct 2012 17:32:00 -0000 From: Eli Zaretskii Subject: Re: Old OSes compatibility [Re: 64-bit (>4GB) inferior data types rules; TYPE_LENGTH: unsigned -> ULONGEST] In-reply-to: <20121001164833.GA20592@host2.jankratochvil.net> To: Jan Kratochvil Cc: brobecker@adacore.com, gdb@sourceware.org, siddhesh@redhat.com Reply-to: Eli Zaretskii Message-id: <83d312ayjy.fsf@gnu.org> References: <20120928173229.GA10406@host2.jankratochvil.net> <20120930165630.GA30746@adacore.com> <20121001164833.GA20592@host2.jankratochvil.net> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-10/txt/msg00005.txt.bz2 > Date: Mon, 1 Oct 2012 18:48:33 +0200 > From: Jan Kratochvil > Cc: gdb@sourceware.org, Siddhesh Poyarekar > > On Sun, 30 Sep 2012 18:56:30 +0200, Joel Brobecker wrote: > > > BTW for size_t/ssize_t format string is "%z". > > > > Unfortunately, that's C99... Not sure what the best approach would > > be - I think people typically cast to long or unsigned long and > > then use the us %l or %ul. > > this is repeating issue, GDB is not C90 compatible despite being claimed so: > Re: [no-commit-intention] Naive unnamed fields for main_type [...] > http://sourceware.org/ml/gdb-patches/2012-02/msg00146.html > > GDB has not been kept compatible even with Solaris which is a very live OS: > Various build-related fixes for solaris > http://sourceware.org/ml/gdb-patches/2012-09/msg00404.html > > Summary of the first thread (authorship of the statements is in mails above): > > Even GCC does not fully support C99 ( http://gcc.gnu.org/c99status.html ) > but all compilers in use support the important parts of C99, incl. gcc-2.9x. > As an example anonymous unions are supported by MS Visual Studio 6.0 (1998), > http://msdn.microsoft.com/en-us/library/aa270923%28v=vs.60%29.aspx > 'long long' is supported at least by MS Visual Studio 2005: > http://msdn.microsoft.com/en-us/library/s3f49ktz%28v=vs.80%29.aspx It is not a good idea to judge about overall C99 acceptance by looking at its select features. Some features are very widespread, others much less. Therefore, the fact that MSVC supports anonymous unions says nothing about its support of %z. Moreover, at least regarding the MS platforms and MinGW (not MSVC), there are 2 separate components involved. One is GCC, which could be very modern and know about C99 and %z, the other is the runtime library, which is not redistributable, and therefore one uses whatever came with the OS out of the box. For example, a Windows XP system will generally have runtime that goes back to Studio 2003 (VC version 7.1), and Windows 7 will use VC v9.0, I think, from Studio 2008. These are quite old. And support for %z comes from the library, of course. > Therefore I believe "%z" is OK, it would be nice to check it with several > major non-GNU systems whether gnulib vasprintf should be already included. FWIW, even the latest Studio 2012 doesn't yet support %z, according to this: http://msdn.microsoft.com/en-us/library/hf4y5e3w%28v=vs.110%29.aspx