gpt4 book ai didi

c++ - 未记录的 GCC 扩展 : VLA in struct

转载 作者:IT王子 更新时间:2023-10-28 23:33:32 26 4
gpt4 key购买 nike

在阅读 Clang 文档时,我发现了以下有趣的花絮:[1]

clang does not support the gcc extension that allows variable-length arrays in structures. This is for a few reasons: one, it is tricky to implement, two, the extension is completely undocumented, and three, the extension appears to be rarely used. Note that clang does support flexible array members (arrays with a zero or unspecified size at the end of a structure).

如何使用此扩展程序?我的理解是,在构造函数中使用 alloca 会导致堆栈指针在调用函数的末尾恢复,在这种情况下它将是构造函数——而不是在封闭结构的末尾。

感谢您的帮助!

最佳答案

关于c++ - 未记录的 GCC 扩展 : VLA in struct,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12058760/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com