Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.arch Subject: Re: register windows Message-ID: <29935@sun.uucp> Date: Sun, 4-Oct-87 00:06:01 EDT Article-I.D.: sun.29935 Posted: Sun Oct 4 00:06:01 1987 Date-Received: Wed, 7-Oct-87 04:05:42 EDT References: <1242@k.gp.cs.cmu.edu> Sender: news@sun.uucp Distribution: na Lines: 23 > Lose#4: Some programs (particularly Unix's "printf" ) want their parameter > list to be at an address. > > What ways have been used around lose#4 ? Our "printf" uses the "varargs" package, our "varargs.h" include file maps "va_alist" into "__builtin_va_alist" on SPARC machines, and our SPARC compiler recognizes the "__builtin_va_alist" construct and moves arguments from registers to memory as needed. Basically, if you want code using "varargs"-like techniques to work on machines built around the SPARC chip, you'd better not just use any "varargs"-like technique, you'd better use "varargs". (ANSI C contains a similar facility, and mandates its use in this case.) Note that this is a lose of any implementation where arguments are passed in registers; it can either be supported by requiring this sort of code to be written using higher-level primitives such as "varargs" rather than low-level fiddling, or by having the compiler somehow detect that the low-level tricks are being used (as I believe MIPSco's compiler for their non-register-window machine does). Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com