Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
To: axp-list@redhat.com
Subject: Re: gcc-2.96 problem under rh70
Date: Tue, 6 Feb 2001 08:55:20 -0700	[thread overview]
Message-ID: <20010206085520.A25122@ellpspace.math.ualberta.ca> (raw)
In-Reply-To: <20010206145801.A3282@twister.gmd.de>; from Georg Wittig on Tue, Feb 06, 2001 at 02:58:01PM +0100

On Tue, Feb 06, 2001 at 02:58:01PM +0100, Georg Wittig wrote:
> The following program doesn't compile with gcc-2.96:
> 
> ---------------------------------
> #include <stdarg.h>
> #include <varargs.h>
.....

Eh?  Why it should?  This is not a valid C!  You are trying to mix
a standard header <stdarg.h> with an obsolete <varargs.h> which is
provided only for backward compatibility for old sources.

In other words you attempt to use at the same time two different,
incompatible, implementations of variable arguments functions and what
you can possibly get out of there is clearly undefined.  It may even
work if you are (un)lucky enough.  OTOH you cannot predict that it will
not launch 'nethack' if it will compile.  Standard documents explicitely
say that "using #undef on va_start and va_args macros leads to
_undefined behaviour_".  They are indeed numb on attempts of a
redefinition but this is effectively an "#undef" as well.  What is even
worse results _may_ be different if you will switch an order of these
two "#include" lines above.

It is quite possible that some compilers may swallow that but I can
only be happy for the one which will barf on this obvious programmer
error.  If you want a code which is acceptable to pre-Standard
compilers then use some configuration means and provide two different
implementations compiled conditionally.

  Michal




      parent reply	other threads:[~2001-02-06 15:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-06 13:58 gcc-2.96 problem under rh70 Georg Wittig
2001-02-06 15:32 ` Matt Wilson
2001-02-07 12:59   ` Georg Wittig
2001-02-07 16:12     ` PCi64 memory Speedracer
2001-02-07 16:32       ` Jay Estabrook
2001-02-07 20:11         ` geerten kuiper
2001-02-06 15:55 ` Michal Jaegermann [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox