cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

US365 32.08 [thread.coord] For latch and barrier, do not require ptrdiff_t support P1865 #361

Closed wg21bot closed 4 years ago

wg21bot commented 5 years ago

latch and barrier currently take a ptrdiff_t as their expected count parameter and thus must support any expected count (larger than or equal to 0) that will fit in a ptrdiff_t. This limits implementation freedom; some platforms can provide a much more efficient implementation of latch and barrier if they can restrict the maximum possible expected count.

Proposed change: Adopt P1865, which adds a static constexpr ptrdiff_t max() noexcept; member to both classes that returns the expressible range of the object, like the one on counting_semaphore.

dkolsen-pgi commented 5 years ago

See P1865 Add max() to latch and barrier cplusplus/papers#617

ogiroux commented 4 years ago

It is not a tragedy if we (in '20, towards responding to US 365)... Specify an implementation-defined maximum count for latches and barriers 15 Have only undefined behavior as the outcome if the maximum count is to be exceeded 9 Have a value_type member to specify the count type instead of ptrdiff_t 9 Mandate an error check (like an exception) if this count is exceeded 10 Have a ::max() member to query the value of this count 17 Have a least_max template argument to override this count 15

Recommend we add a least_max template argument with an implementation-defined default value and ::max() member (match counting_semaphore<>), in response to US 365: template class barrier; SF F N A SA 3 14 2 0 1 SA: I do not like the template argument Consensus for change

tituswinters commented 4 years ago

LEWG in Belfast: We disagree with the change to class template, the R0 of this paper is better (see notes). Forward P1865R0 to LWG for C++20.

(Prioritization on this vs. other paper-sized NB comments will be shared with LWG chair when LEWG finishes NB comment processing.)

JeffGarland commented 4 years ago

Reviewed by LWG in Belfast on Thu afternoon. Unanimous consent with 2 minor changes for c++20.

jensmaurer commented 4 years ago

Accepted with modification. See paper P1865R1.