-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
questionFurther information is requestedFurther information is requestedresolvedSuccessfully resolved without a commitSuccessfully resolved without a commit
Description
It may sound surprising, but:
- 32-bit pointers are available for 64-bit compilation, and vice versa
- There are explicitly signed and unsinged pointers, and "normal" pointers behave as signed
STL does not support this feature fully. They work with is_pointer_v, but not with atomic.
Example:
#include <Windows.h>
#include <atomic>
#include <iostream>
#include <type_traits>
int main() {
std::cout << std::is_pointer_v<int* POINTER_32> << '\n'; // prints 1
std::cout << std::is_pointer_v<int* POINTER_64> << '\n'; // prints 1
std::atomic<int* POINTER_32> sp32;
sp32.fetch_add(1); // this does not compile on 64-bit
std::atomic<int* POINTER_64> sp64;
sp64.fetch_add(1); // this does not compile on 32-bit
}
Should they be supported fully by STL?
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requestedresolvedSuccessfully resolved without a commitSuccessfully resolved without a commit