Path: utzoo!attcan!uunet!vsi!friedl From: friedl@vsi.COM (Stephen J. Friedl) Newsgroups: comp.lang.c Subject: Re: passing variable numbers of arguments Summary: Crazy arg-passing Message-ID: <1002@vsi.COM> Date: 11 Jan 89 01:54:04 GMT References: <899@thor.stolaf.edu> <15341@mimsy.UUCP> <449@marob.MASA.COM> <9321@smoke.BRL.MIL> Distribution: na Organization: V-Systems, Inc. -- Santa Ana, CA Lines: 34 In article <9321@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn ) writes: > > The reason that > the va_ stuff must be used for portable access to arguments is that > many architectures do not have a simple, clean model for argument > alignment (which might be different from that indicated by sizeof), > and some pass some of the arguments different from others. Doug is being polite here -- there are some *very* crazy arg-passing schemes out there. The Zilog Z8000 machine I used in school had an "efficient" arg passing mechanism that passed the first few args in registers. There were six or so 16-bit registers allocated for this, and 32-bit quantities passed in register pairs R0+R1 = RR0, R2+R3=RR2, etc. There were all kinds of rules for alignment restrictions on this, *PLUS* the machine had a segmented and a non-segmented mode which meant that pointers could be two different lengths. If they had varargs (it was Sys III), it must have been hell to put together. I do know that their _doprnt() had *five* args to accomodate this. I remember a time several years ago in school that I naively claimed that taking the address of an arg and (*argp++) up the stack was portable because "everybody passes args this way". The amazing follies of youth :-). Steve -- Stephen J. Friedl 3B2-kind-of-guy friedl@vsi.com V-Systems, Inc. I speak for me only attmail!vsi!friedl Santa Ana, CA USA +1 714 545 6442 {backbones}!vsi!friedl -------Nancy Reagan on Usenix in San Diego: "Just say *go*"-------