Sujet : Re: Futex Stack Test...
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.c++Date : 18. Feb 2025, 20:13:53
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vp2m5h$1r0qt$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 2/18/25 02:01, Paavo Helde wrote:
On 18.02.2025 01:17, Chris M. Thomasson wrote:
...
Seamed to work fine, but compilation produced some warnings about the
CT_WAIT macro.
Build started at 08:55...
1>------ Build started: Project: ConsoleTest2022, Configuration: Release
x64 ------
1>futex-stack-test.cpp
1>C:\Test\ConsoleTestVS2022\ConsoleTest2022\futex-stack-test.cpp(55,25):
warning C4312: 'type cast': conversion from 'unsigned int' to 'ct_node
*' of greater size
1>C:\Test\ConsoleTestVS2022\ConsoleTest2022\futex-stack-test.cpp(71,21):
warning C4312: 'type cast': conversion from 'unsigned int' to 'ct_node
*' of greater size
1>C:\Test\ConsoleTestVS2022\ConsoleTest2022\futex-stack-test.cpp(87,38):
warning C4312: 'type cast': conversion from 'unsigned int' to 'ct_node
*' of greater size
1>C:\Test\ConsoleTestVS2022\ConsoleTest2022\futex-stack-test.cpp(90,40):
warning C4312: 'type cast': conversion from 'unsigned int' to 'ct_node
*' of greater size
1>C:\Test\ConsoleTestVS2022\ConsoleTest2022\futex-stack-test.cpp(92,39):
warning C4312: 'type cast': conversion from 'unsigned int' to 'ct_node
*' of greater size
1>C:\Test\ConsoleTestVS2022\ConsoleTest2022\futex-stack-test.cpp(94,33):
warning C4312: 'type cast': conversion from 'unsigned int' to 'ct_node
*' of greater size
1>C:\Test\ConsoleTestVS2022\ConsoleTest2022\futex-stack-test.cpp(185,38):
warning C4312: 'type cast': conversion from 'unsigned int' to 'ct_node
*' of greater size
...
#define CT_WAIT ((ct_node*)0xDEADBEEF)
That should be a reinterpret_cast<>. Correcting that gets rid of all of
those messages.
Also, the following expressions should all use static_cast<>:
ct_work* head = (ct_work*)shared.m_stack_in.flush_wait();
...
ct_work* next = (ct_work*)head->m_next;
...
ct_work* head = (ct_work*)shared.m_stack_out.flush_wait();
...
ct_work* next = (ct_work*)head->m_next;
...
ct_work* head =
(ct_work*)shared.m_stack_in.m_head.load(std::memory_order_relaxed);
...
ct_work* next = (ct_work*)head->m_next