Xcode 16 Typed Allocators

From the Xcode 16 Release notes:

Clang

New Features

Clang now supports generating code to call typed allocators. To enable this support for C allocation functions such as malloc() set the CLANG_ENABLE_C_TYPED_ALLOCATOR_SUPPORT build setting to YES. For C++ allocations with operator new, set CLANG_ENABLE_CPLUSPLUS_TYPED_ALLOCATOR_SUPPORT to YES. (132456928)

Looking in the Build Settings I don't see anything that says Typed Allocator or something similar. I would love to have a bit more information about what this is as well.

Answered by DTS Engineer in 805561022

Looking in the Build Settings I don't see anything that says Typed Allocator or something similar.

You can add these settings as User-Defined build settings. When you do that, you'll see the default value is compiler-default, as an indication that you didn't make any mistake in naming the setting when you added it.

I would love to have a bit more information about what this is as well.

These are safety features to help mitigate memory errors in C languages. You can read about the details in an RFC that's part of the LLVM open source project: https://discourse.llvm.org/t/rfc-typed-allocator-support/79720

— Ed Ford,  DTS Engineer

Accepted Answer

Looking in the Build Settings I don't see anything that says Typed Allocator or something similar.

You can add these settings as User-Defined build settings. When you do that, you'll see the default value is compiler-default, as an indication that you didn't make any mistake in naming the setting when you added it.

I would love to have a bit more information about what this is as well.

These are safety features to help mitigate memory errors in C languages. You can read about the details in an RFC that's part of the LLVM open source project: https://discourse.llvm.org/t/rfc-typed-allocator-support/79720

— Ed Ford,  DTS Engineer

Thank you, we write a lot of C++ and will gladly take any safety we can get.

Xcode 16 Typed Allocators
 
 
Q