J
James Kuyper
On 04/20/2012 04:33 AM, Noob wrote:
....
If you need to address issues like that, portability is no longer an
option. The best you can do is choose a target set of platforms and
write code that works on all of the platforms in that set, but might not
work on platforms outside that set.
On the plus side, this gives you the freedom to use features that are
only available on those platforms, so long as those features are
available on all of the target platforms. The best place to get advice
about such things is a forum specific to those platforms; this is not
such a forum. In such a forum, you might learn that someone has already
addressed the issue you're dealing with.
....
malloc works within the framework of the /abstract/ machine. But there
is /real/ hardware behind this abstraction. (I did state I was leaving
the realm of standard C in the paragraph you snipped.)
To name a few reasons for "stricter" alignment than what malloc provides,
consider aligning on a cache line boundary for performance, or aligning
on a page boundary in virtual memory code, or satisfying the requirements
of the USB protocol in driver code.
If you need to address issues like that, portability is no longer an
option. The best you can do is choose a target set of platforms and
write code that works on all of the platforms in that set, but might not
work on platforms outside that set.
On the plus side, this gives you the freedom to use features that are
only available on those platforms, so long as those features are
available on all of the target platforms. The best place to get advice
about such things is a forum specific to those platforms; this is not
such a forum. In such a forum, you might learn that someone has already
addressed the issue you're dealing with.