Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!pyramid!pesnta!wjvax!brett From: brett@wjvax.UUCP (Brett Galloway) Newsgroups: net.lang.c Subject: Re: Re: varargs fails on typedefs Message-ID: <736@wjvax.wjvax.UUCP> Date: Tue, 29-Jul-86 20:49:34 EDT Article-I.D.: wjvax.736 Posted: Tue Jul 29 20:49:34 1986 Date-Received: Thu, 31-Jul-86 02:51:08 EDT Reply-To: brett@wjvax.UUCP (Brett Galloway) Organization: Watkins-Johnson Co., San Jose, Calif. Lines: 46 Keywords: stdarg, varargs Doug Gwyn sent me E-mail responding to my posting about the need for a promote() operator to implement varargs. Unforunately, our mailer is broken, so I cannot respond privately. In any event, I believe that his response is of interest: >This is the second such suggestion in recent weeks. >I think we should be careful to distinguish between what the >application code/programmer sees for an interface and >what the C runtime implementer needs for his implementation. > can be used safely if the programmer specifies >the correct (possibly widened) type and if he restricts himself >to the simpler data types. X3J11 has designed to >replace , but there is still room for debate about >the current design. >Statements such as " cannot be implemented without >a promote() or alignof() operator" are simply false. The >existence of such operators would not even be sufficient for some >architectures. Rather than specify such fine-grained details >of use only for implementing varargs, X3J11 is leaving it up >to the implementor how he pulls this trick, and is specifying >only the application code/programmer visible interface. If >this interface is properly designed, it will be implementable >"somehow" on every significant architecture (although perhaps >not purely in C). As might be guessed, I disagree. Of course, varargs can be implemented without a promote() or alignof() operator; it is so implemented now. However, it imposes the restrictions that Doug cites: "if the programmer specifies the correct (possibly widened) type and if he restricts himself to the simpler data types." I argue that a promote() operator is necessary to remove these restrictions. My article referred to using typedef'd types in varargs, and, in fact, without a promote() operator, using typedef'd types in varargs is impossible. Note that promote() is a necessary condition; not a sufficient condition. In short, I believe that X3J11, by omitting the (normally invisible) promote() operator, is forcing itself to limit the usefulness of the (visible) stdarg interface. -- ------------- Brett Galloway {pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett