A RetroSearch Logo

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

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue2377 below:

Issue 2377: std::align requirements overly strict

This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

2377. std::align requirements overly strict

Section: 20.2.5 [ptr.align] Status: C++17 Submitter: Peter Dimov Opened: 2014-03-30 Last modified: 2017-07-30

Priority: 0

View other active issues in [ptr.align].

View all other issues in [ptr.align].

View all issues with C++17 status.

Discussion:

std::align requires that its alignment argument shall be "a fundamental alignment value or an extended alignment value supported by the implementation in this context".

This requirement is overly strict. There are use cases that require a buffer aligned at values that are not tied to the C++ implementation, such as page size, cache line size, sector size. These come from the hardware or the OS and are generally not known until run time. The implementation of std::align does not depend on the requirement that alignment be a fundamental or an extended alignment value; any power of two would be handled the same way. In addition, it is not possible for the user to even determine whether a value is "a fundamental alignment value or an extended alignment value supported by the implementation in this context". One would expect values coming from alignof to be fine, but I'm not sure whether even that is guaranteed in the presence of alignas. Therefore, I propose that

Requires:

be changed to

Requires:

[2014-06-16 Rapperswil]

Move to Ready

Proposed resolution:

This wording is relative to N3936.

  1. Edit 20.2.5 [ptr.align] p2 as indicated:

    void* align(std::size_t alignment, std::size_t size,
      void*& ptr, std::size_t& space);
    

    -1- […]

    -2- Requires:
    • alignment shall be a fundamental alignment value or an extended alignment value supported by the implementation in this context power of two


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