Chromium Code Reviews| Index: base/compiler_specific.h |
| diff --git a/base/compiler_specific.h b/base/compiler_specific.h |
| index 64273a98db93c4fc0158690958bc7cd4de225d32..5d7d9d11019bd22bc0a9c9e28f06ccb036566a5e 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 |
|
willchan no longer on Chromium
2012/07/23 20:37:18
Minor nit, I think there's no need for a shortened
DaleCurtis
2012/07/23 21:15:04
Done. I'll forward any hate mail I get for a 134 c
|
| // 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)) |
| #elif defined(COMPILER_GCC) |
| #define ALIGNOF(type) __alignof__(type) |
| #endif |