<div dir="ltr">I have the following code (C11):<br><br>#define vector_grow(vec, count)                                                                     \<br>do {                                                                                                \<br>    if(!(vec)) {                                                                                    \<br>        size_t *__p = (size_t*) malloc ((size_t)(count) * sizeof(*(vec)) + (sizeof(size_t) * 2));   \<br>        assert(__p);                                                                                \<br>        (vec) = (void *)(&__p[2]);                                                                  \<br>        vector_set_capacity((vec), (count));                                                        \<br>        vector_set_size((vec), 0);                                                                  \<br>    } else {                                                                                        \<br>        size_t *__p1 = &((size_t *)(vec))[-2];                                                      \ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<br>        size_t *__p2 = realloc(__p1, ((size_t)(count) * sizeof(*(vec))+ (sizeof(size_t) * 2)));     \<br>        assert(__p2);                                                                               \<br>        (vec) = (void *)(&__p2[2]);                                                                 \<br>        vector_set_capacity((vec), (count));                                                        \<br>    }                                                                                               \<br>} while(0)<br><br>With -Wall it generates the following warning: cast from 'float *' to 'size_t *' (aka 'unsigned long long *') increases required alignment from 4 to 8 [-Wcast-align], triggered by the indicated line, in case the type of pointer is smaller than size_t.<br><br>I get the gist of it, but reading the std (taking <a href="http://cppreference.com">cppreference.com</a>'s word for it), this seems un-necessary.<br><br>malloc: "If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block <b>that is suitably aligned for any object type</b>.".<br>and aligned_alloc: "Regular malloc aligns memory suitable for any object type (which, in practice, <b>means that it is aligned to alignof(max_align_t))</b>.", which means long double.<br>It appears that even on Windows (without a real long double), alignment *is* at least 16.<br><br>No warning on this issue from VS 15.6.6.<br><br></div>