aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/UnalignedArrayAssert.dox
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2018-09-21 11:51:49 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2018-09-21 11:51:49 +0200
commita488d59787d25337fd71bcc994d1c2c6ab011731 (patch)
tree2ac09b50a43bf7586f8df8ac0c069902e326773b /doc/UnalignedArrayAssert.dox
parent47720e797012f6ef2f50da1f0e79fdc4f16e60a1 (diff)
parent3ec29859146f33e323ebd6d41e46acda63dffcef (diff)
merge with default Eigen
Diffstat (limited to 'doc/UnalignedArrayAssert.dox')
-rw-r--r--doc/UnalignedArrayAssert.dox4
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/UnalignedArrayAssert.dox b/doc/UnalignedArrayAssert.dox
index 0f7022973..8676faa1b 100644
--- a/doc/UnalignedArrayAssert.dox
+++ b/doc/UnalignedArrayAssert.dox
@@ -117,8 +117,8 @@ It doesn't disable 16-byte alignment, because that would mean that vectorized an
\section checkmycode How can I check my code is safe regarding alignment issues?
-Unfortunately, there is no possibility in C++ to detect any of the aformentioned shortcoming at compile time (though static analysers are becoming more and more powerful and could detect some of them).
-Even at runtime, all we can do is to catch invalid unaligned allocation and trigger the explicit assertion mentioned at the begining of this page.
+Unfortunately, there is no possibility in C++ to detect any of the aforementioned shortcoming at compile time (though static analysers are becoming more and more powerful and could detect some of them).
+Even at runtime, all we can do is to catch invalid unaligned allocation and trigger the explicit assertion mentioned at the beginning of this page.
Therefore, if your program runs fine on a given system with some given compilation flags, then this does not guarantee that your code is safe. For instance, on most 64 bits systems buffer are aligned on 16 bytes boundary and so, if you do not enable AVX instruction set, then your code will run fine. On the other hand, the same code may assert if moving to a more exotic platform, or enabling AVX instructions that required 32 bytes alignment by default.
The situation is not hopeless though. Assuming your code is well covered by unit test, then you can check its alignment safety by linking it to a custom malloc library returning 8 bytes aligned buffers only. This way all alignment shortcomings should pop-up. To this end, you must also compile your program with \link TopicPreprocessorDirectivesPerformance EIGEN_MALLOC_ALREADY_ALIGNED=0 \endlink.