A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cplusplus/draft/issues/966 below:

Behaviour of `std::pmr::memory_resource::do_allocate()` is ambiguous · Issue #966 · cplusplus/draft · GitHub

essentially a copy of this StackOverflow question.

To quote N4606:

virtual void* do_allocate(size_t bytes, size_t alignment) = 0;

Requires: Alignment shall be a power of two.

Returns: A derived class shall implement this function to return a pointer to allocated storage (3.7.4.2) with a size of at least bytes. The returned storage is aligned to the specified alignment, if such alignment is supported; otherwise it is aligned to max_align.

Throws: A derived class implementation shall throw an appropriate exception if it is unable to allocate memory with the requested size and alignment.

This is ambiguous: What happens if the alignment is a power of two but unsupported (e.g larger than max_align)? Is the returned storage aligned to max_align or is an exception thrown?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4