Re: Is this the ultimate stack-smash fix?

Andreas Bombe (andreas.bombe@munich.netsurf.de)
Tue, 20 Feb 2001 02:10:12 +0100


On Sat, Feb 17, 2001 at 09:53:48PM -0700, Eric W. Biederman wrote:
> Peter Samuelson <peter@cadcamlab.org> writes:
> > It also sounds like you will be
> > breaking the extremely useful C postulate that, at the ABI level at
> > least, arrays and pointers are equivalent. I can't see *how* you plan
> > to work around that one.
>
> Huh? Pointers and arrays are clearly different at the ABI level.
>
> A pointer is a word that contains an address of something.
> An array is an array.

An array is a word that contains the address of the first element.

Exercise 1: What is the difference between the following two
declarations at the source level and at the ABI level?

a) int main(int argc, char *argv[])
b) int main(int argc, char **argv)

Exercise 2: What would the following in hypothetical C startup code do?

char *args[10];
int count = 10;

...

exit(main(count - 1, args + 1));

-- 
 Andreas E. Bombe <andreas.bombe@munich.netsurf.de>    DSA key 0x04880A44
http://home.pages.de/~andreas.bombe/    http://linux1394.sourceforge.net/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/