Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3182)

Unified Diff: base/compiler_specific.h

Issue 10796020: Upgrade AlignedMemory to support dynamic allocations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Documentation. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/lazy_instance.h » ('j') | base/memory/aligned_memory.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/compiler_specific.h
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 64273a98db93c4fc0158690958bc7cd4de225d32..342f3ea8b2f7e338bc9a7973c0eae948e45b7930 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -114,11 +114,13 @@
#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
#endif
-// Return the byte alignment of the given type (available at compile time).
+// Return the byte alignment of the given type (available at compile time). Use
+// sizeof(type) prior to checking __alignof to workaround Visual C++ bug:
+// http://goo.gl/isH0C
scherkus (not reviewing) 2012/07/19 21:49:39 FYI it's ok to exceed 80 chars for long urls
DaleCurtis 2012/07/20 02:38:56 Yeah, this one is 131 chars though, so it seemed n
// Use like:
// ALIGNOF(int32) // this would be 4
#if defined(COMPILER_MSVC)
-#define ALIGNOF(type) __alignof(type)
+#define ALIGNOF(type) (sizeof(type) - sizeof(type)) + __alignof(type)
jbates 2012/07/19 03:45:37 parens should probably go around the whole express
DaleCurtis 2012/07/20 02:38:56 Done.
#elif defined(COMPILER_GCC)
#define ALIGNOF(type) __alignof__(type)
#endif
« no previous file with comments | « no previous file | base/lazy_instance.h » ('j') | base/memory/aligned_memory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698