From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id 72EE92F005 for ; Tue, 6 Feb 2001 10:55:26 -0500 (EST) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id f16FtZj31513 for axp-list@listman.redhat.com; Tue, 6 Feb 2001 10:55:35 -0500 Received: from ellpspace.math.ualberta.ca (IDENT:michal@ellpspace.math.ualberta.ca [129.128.207.67]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id f16FtYd31507 for ; Tue, 6 Feb 2001 10:55:34 -0500 Received: (from michal@localhost) by ellpspace.math.ualberta.ca (8.9.3/8.9.3) id IAA25164 for axp-list@redhat.com; Tue, 6 Feb 2001 08:55:20 -0700 Date: Tue, 6 Feb 2001 08:55:20 -0700 From: Michal Jaegermann To: axp-list@redhat.com Subject: Re: gcc-2.96 problem under rh70 Message-ID: <20010206085520.A25122@ellpspace.math.ualberta.ca> References: <20010206145801.A3282@twister.gmd.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4us In-Reply-To: <20010206145801.A3282@twister.gmd.de>; from Georg Wittig on Tue, Feb 06, 2001 at 02:58:01PM +0100 X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0beta4 Precedence: bulk Reply-To: axp-list@redhat.com List-Id: Linux and Red Hat on Alpha processors On Tue, Feb 06, 2001 at 02:58:01PM +0100, Georg Wittig wrote: > The following program doesn't compile with gcc-2.96: > > --------------------------------- > #include > #include ..... Eh? Why it should? This is not a valid C! You are trying to mix a standard header with an obsolete 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