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

标签 visual-studio c++17

尽管我确实尝试分别启用 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/

相关文章:

c++ - IP到长转换c++

c++ - windows.h 之间的区别stdafx.h

c++ - "The World' s Dumbest Smart Pointer 有什么意义?”

c++ - 如何在保留弃用警告的同时删除类

c# - Visual Studio Debug模式下的结构和类显示值

mysql - 无法通过Visual Studio 2012连接MySQL数据库

c++ - 使用std::initializer_list参数的非成员函数(/非构造函数上下文)的重载解析

c++ - 多维 std::array 的可变参数模板

c++ - 如何在C++中使用<文件系统>访问相对父目录

c# - 实现接口(interface)时出错: class doesn't implement interface members