C++ Logo

std-discussion

Advanced search

Re: Guaranteed size of binary semaphore?

From: KL <deco33000_at_[hidden]>
Date: Thu, 31 Mar 2022 21:21:29 +0200

Thanks, will do
--

20:19, 31 March 2022, Jens Maurer <jens.maurer_at_[hidden]>:

On 31/03/2022 20.00, KL via Std-Discussion wrote:

 Hi,

 I measured the size of a binary semaphore.
 https://en.cppreference.com/w/cpp/thread/counting_semaphore

 I found 4 bytes, the size of an int32_t on a 64 bit system.

 I need your confirmation that this size won't vary in the future and that it is not implementation defined.


The size of any type is implementation-defined.

 I rely on that inside a mmap structure that won't be touched later. Arch: amd64.


Some implementations make an effort to remain ABI-compatible as they evolve,
which includes keeping the size of library-defined classes the same.
However, that's entirely at the discretion of the implementation.

Please contact the vendor of your implementation if you seek any such guarantees.

Jens

Received on 2022-03-31 19:21:31