Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!ll-xn!mit-eddie!uw-beaver!uw-june!pardo From: pardo@june.cs.washington.edu (David Keppel) Newsgroups: comp.lang.c Subject: Re: variable number of strings passed to function - how? Message-ID: <6169@june.cs.washington.edu> Date: 21 Oct 88 21:48:41 GMT References: <434@tutor.UUCP> <3533@ihuxz.ATT.COM> Reply-To: pardo@cs.washington.edu (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 26 >>[ I want to do string varargs ] In article <3533@ihuxz.ATT.COM> burris@ihuxz.ATT.COM (Burris) writes: >[ In C, args are put on the stack in reverse order so the first arg > is the lowest arg of the stack ponter ] >[ example deleted ] NO! DON'T TOUCH THAT... This is true on *some* machines, but is certainly false on other machines. There are a couple reasons why. One is that the C language doesn't define things to be done this way, so anybody who wants to push right-to-left can do so as long as their compiler works. I'm not sure that any modern compilers do this *currently*, but (a) there have been in the past and (b) there probably will be again. Another good reason why this isn't portable is that some machines have stacks that grow *up* and some have stacks that grow *down*. Finally, there is no guarantee that the arguments, even arguments of the same size, will be in contiguous memory. How to do this portably? Start with or . Then go read <14015@mimsy.UUCP> (comp.lang.c, 16 Oct 1988). ;-D on ( "Every execution leaves you dangling..." ) Pardo -- pardo@cs.washington.edu {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo