Article View: comp.std.c
Article #2144why is va_start(p, char/short/float) illegal?
From: David Spuler
Date: Mon, 28 Sep 1992 07:40
Date: Mon, 28 Sep 1992 07:40
29 lines
1589 bytes
1589 bytes
The ANSI standard says in Section 7.8.1.1 with regard to the macro: va_start(ap,parmN) that: "If the parameter parmN is declared .... with a type that is not compatible with the type that results after the application of the default argument promotions,the behavior is undefined." This prevents parmN from having char/short/float type. My question is: why is this restriction imposed? It seems to me that the variadic function being defined by <stdarg.h> and va_start will have a prototype with the ellipsis function, and can assume that all calls to it will be governed by a prototype, and therefore need not have the default promotions applied to the named parameters. I see no reason why the compiler can't support char/short/float types. Sorry if this is discussed in the "rationale", but I haven't a copy of it. Thanks for any insight, David Spuler -- David Spuler, James Cook University of North Queensland, Australia Author of "Comprehensive C", Prentice-Hall, 1992, pp416, ISBN 0-13-156514-1 INTRO TOPICS: types, operators, structures, strings, fns, ptrs, files etc etc ADVANCED TOPICS: efficiency, debugging, style, portability, large programs
Technical Details
Message-ID:
<spuler.717666010@coral>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!marlin.jcu.edu.au!coral.cs.jcu.edu.au!spulerShow Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!marlin.jcu.edu.au!coral.cs.jcu.edu.au!spuler From: spuler@coral.cs.jcu.edu.au (David Spuler) Subject: why is va_start(p, char/short/float) illegal? Message-ID: <spuler.717666010@coral> Sender: news@marlin.jcu.edu.au (USENET News System) Organization: James Cook University Date: 28 Sep 92 07:40:10 GMT Lines: 29