Alignment guarantees of static char array

前端 未结 3 1684
长情又很酷
长情又很酷 2020-12-18 08:48

I want to know the alignment guarantees of a statically allocated array of char. Looking at other SO questions, I found some concerning dynamically allocated ar

3条回答
  •  时光说笑
    2020-12-18 09:28

    No. Statically allocated arrays are aligned to sizeof(element_type) bytes -- for char it is 1 byte, which basically guarantees no alignment.

提交回复
热议问题