gpt4 book ai didi

visual-studio - Visual Studio 2019 中缺少 std::aligned_alloc() 吗?

转载 作者:行者123 更新时间:2023-12-04 15:22:44 26 4
gpt4 key购买 nike

尽管我确实尝试分别启用 std:c++latest 和 c++17,但我无法使用 c++17 中添加的 std::aligned_alloc() 函数。这是真实生活吗? Visual Studio 2019 是否完全没有在标准中实现这样一个古老的功能(也是一个非常重要的功能)?其他人可以确认吗?
我所指的功能:
https://en.cppreference.com/w/cpp/memory/c/aligned_alloc

最佳答案

来自 Microsoft C++ language conformance table对于 VC++ 2019:

C11 - The Universal CRT implemented the parts of the C11 Standard Library that are required by C++17, with the exception of C99 strftime() E/O alternative conversion specifiers, C11 fopen() exclusive mode, and C11 aligned_alloc(). The latter is unlikely to be implemented, because C11 specified aligned_alloc() in a way that's incompatible with the Microsoft implementation of free(): namely, that free() must be able to handle highly aligned allocations.


VC++ 具有特定于编译器的 _aligned_malloc对于对齐到 2 的幂的内存,另见 What can I use instead of std::aligned_alloc in MS Visual Studio 2013? .

关于visual-studio - Visual Studio 2019 中缺少 std::aligned_alloc() 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62962839/

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