Path: utzoo!attcan!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: Will it execute everywhere ? Message-ID: <358@taumet.com> Date: 28 Jul 90 22:07:03 GMT References: <831@gtenmc.UUCP> Distribution: na Organization: Taumetric Corporation, San Diego Lines: 29 csp@gtenmc.UUCP (Charudutta S. Palkar) writes: > This is to avoid the usage of varargs. The only restriction > is to pass number of arguments as the first parameter. > 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? [ included code which scanned up the stack from first parameter ] 1. Some systems do not necessarily pass parameters on a stack. To get variable parameter lists, you need help from the compiler. 2. On some systems the stack grows up, on some it grows down. Some systems push parameters left-to-right, others right-to-left. Combining these two unknowns, you might scan up OR down from the first parameter to find the rest. 3. Some systems use differing alignments when pushing arguments on the stack, and a simple scan will fail. Some Unix systems added , and ANSI standardized on , so that you could write code that would always work, no matter how the compiler or implementation changed. If you can't or won't use these aids, you will have to check each release of each compiler and each runtime system to see whether the code you write will work. -- Steve Clamage, TauMetric Corp, steve@taumet.com