This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Old OSes compatibility [Re: 64-bit (>4GB) inferior data types rules; TYPE_LENGTH: unsigned -> ULONGEST]


> Date: Mon, 1 Oct 2012 18:48:33 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb@sourceware.org, Siddhesh Poyarekar <siddhesh@redhat.com>
> 
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]