Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!samsung!umich!caen!math.lsa.umich.edu!rphroy!kyzyl!tkacik From: tkacik@kyzyl.mi.org (Tom Tkacik) Newsgroups: comp.lang.c Subject: Re: Will it execute everywhere ? Message-ID: <229@kyzyl.mi.org> Date: 29 Jul 90 15:00:42 GMT References: <831@gtenmc.UUCP> Distribution: na Organization: Somewhere in Royal Oak, MI Lines: 27 In article <831@gtenmc.UUCP>, csp@gtenmc.UUCP (Charudutta S. Palkar) writes: > Will this piece of code execute irrespective of the order > in which the parameters are pushed on the stack ie. right > to left or left to right? This is executable on Unix V.3 > on a VAX-8000. > void ftest(n) > int n; > { > char **p; > p = (char **)( &n + 1 ); > while( n-- ) > printf("%s",*p++); > } This is not portable. It requires that the stack grow down. Some machines (eg. AT&T WE32000, used in 3b2's) have a stack that grows up. Others pass the first few parameters in registers. To be portable, use varargs. -- Tom Tkacik tkacik@kyzyl.mi.org Speaking only for myself here in Royal Oak.