Is it safe to cast a heap allocated pointer to a pointer to a VLA?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 06:26:12

The behaviour is undefined if cols is 0 or smaller. C11 made support for VLAs optional (see e.g. here, and you tagged your question C99, where they’re required), if they’re not supported, the macro __STDC_NO_VLA__ is defined to 1 (cf. C11 6.10.8.3 p1).

This aside, you’re safe.

Thanks to Ouah and Alter Mann!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!