Date: Tue, 17 Jun 1997 02:00:02 -0700 (PDT) From: "Arne Henrik Juul" <arnej@math.ntnu.no> To: freebsd-bugs Subject: Re: bin/3884: stdarg.h fails for data types < 4 bytes Message-ID: <199706170900.CAA04342@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/3884; it has been noted by GNATS.
From: "Arne Henrik Juul" <arnej@math.ntnu.no>
To: Bruce Evans <bde@zeta.org.au>, arnej@mail.math.ntnu.no,
FreeBSD-gnats-submit@FreeBSD.ORG
Cc: Subject: Re: bin/3884: stdarg.h fails for data types < 4 bytes
Date: Tue, 17 Jun 1997 10:50:26 +0200
On Jun 17, 13:37, Bruce Evans wrote:
> Subject: Re: bin/3884: stdarg.h fails for data types < 4 bytes
>
> This is correct.
I will argue that it is not.
> The behaviour is undefined when the type in va_arg()
> does not match its default promotion.
Correct but irrelevant.
> > Probably stdarg.h should
> > follow the conventions of the C compiler instead.
>
> Probably not. Generating an error is useful for detecting unportable
> code. However, it would be better to generate the error at compile time,
> and also detect float types (which happen to have the same size as their
> default promotion on i386's) and on char and short types (which may
> happen to have the same size as their default promotion on non-i386's).
> I don't know how to do this without using a compiler builtin.
We should probably ask for one, then :-)
> >>How-To-Repeat:
> >
> > Inspect <stdarg.h>, or compile and run the following test
> > program, gotten from c-torture.
>
> This program does not conform to standard C.
If it used short, I would agree with you. However, it uses a struct,
and structs doesn't promote at all. Therefore, the program is
conforming (maybe even strictly conforming) Ansi C and must work.
- Arne H. J.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706170900.CAA04342>
