Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jan 1998 20:09:35 -0600 (CST)
From:      Joel Ray Holveck <joelh@gnu.org>
To:        fenner@parc.xerox.com
Cc:        sef@kithrup.com, current@FreeBSD.ORG
Subject:   Re: Nasty GCC bug?
Message-ID:  <199801210209.UAA01144@detlev.UUCP>
In-Reply-To: <98Jan20.171409pst.177476@crevenia.parc.xerox.com> (message from Bill Fenner on Tue, 20 Jan 1998 17:14:03 PST)
References:   <98Jan20.171409pst.177476@crevenia.parc.xerox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>>> ... on systems which do not use an integer stack based calling
>>> convention, the value can be treated as its type by the varradic
>>> function, instead of being treated as an int.  It is the promotion
>>> caused by the calling convention that is the source of the
>>> breakage.
>> It *has* always been the case; not doing it this way is a bug.
> Not quite.  If you don't do it this way, the behavior is undefined --
> section 7.8.2.1:
> 	...or if type is not compatible with the type of the actual
> 	next argument (as promoted according to the default argument
> 	promotions), the behavior is undefined.
> So it's not *wrong* to allow chars to be passed into varargs functions
> as chars, but the ANSI C specification doesn't require it.  Terry wants
> to define some of this undefined behavior.

I read this to mean that the promotions are required, it's just that
if you mismatch types (eg, printf("%s",15);) then the results are
undefined.

Best,
joelh

-- 
Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801210209.UAA01144>