[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this the ultimate stack-smash fix?


Le 20 Feb 2001 02:10:12 +0100, Andreas Bombe a 馗rit :
> On Sat, Feb 17, 2001 at 09:53:48PM -0700, Eric W. Biederman wrote:
> > Peter Samuelson <peter _at_ 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.


No. Exercise 3: compile and run this:
file a.c:
char array[] = "I'm really an array";

file b.c:
extern char* array;
main() { printf("array = %s\n", array); }

... and watch it biting the dust !
in short: an array is NOT a pointer.


    Xav

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」
Follow-Ups: