Re: Word alignment - Why doesn't this crash?
- From: Andrey Tarasevich <andreytarasevich@xxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 12:53:10 -0700
ollemblomgren@xxxxxxxxx wrote:
I write this program but it doesn't crash. Is it because I'm testing
the wrong thing (my understanding is wrong) or is it because my
environment is very forgiving?
There's no such thing as some mandatory "word alignment". Alignment requirements are type-specific and platform-specific. It is quite possible that in your platform objects of type 'int' can be placed in memory in any way you want, i.e. there are no alignment restrictions as all.
Note also, that the real "platform" you are working with is really the platform provided (emulated) by the compiler. It doesn't necessarily have to inherit all (or any) requirements from the underlying hardware platform. Normally it does for performance reasons, but it is not impossible to implement a C compiler that wouldn't impose any alignment restrictions on any of its data types, even though the underlying hardware platform does have such restriction for "corresponding" hardware data types.
--
Best regards,
Andrey Tarasevich
.
- References:
- Word alignment - Why doesn't this crash?
- From: ollemblomgren
- Word alignment - Why doesn't this crash?
- Prev by Date: Re: Fedup with SPAM
- Next by Date: Re: ?: as an lvalue
- Previous by thread: Re: Word alignment - Why doesn't this crash?
- Next by thread: Fedup with SPAM
- Index(es):
Relevant Pages
|