Date: Mon, 12 May 2025 13:27:25 -0700
On Monday, 12 May 2025 12:39:58 Pacific Daylight Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> assert( wxIsMainThread );
>
> which should have been:
>
> assert( wxIsMainThread() );
>
> I would be in favour of the deprecation of implicit conversion of a
> function pointer to bool -- although maybe that would break too much code.
Compilers already warn about this being an always-true condition.
https://gcc.godbolt.org/z/ord8vsPMW
Clang says "address of function 'wxIsMainThread' will always evaluate to
'true'" and suggest you either add & or (). GCC says "the address of 'bool
wxIsMainThread()' will never be NULL" but is missing the suggestion. MSVC just
complains that you're narrowing from a pointer to a boolean, which isn't the
best warning, but still is a warning.
I do think deprecating the decaying of functions to function pointers is the
correct solution, but the chance of this happening before the entropy death of
the universe are pretty slim.
Gotham via Std-Proposals wrote:
> assert( wxIsMainThread );
>
> which should have been:
>
> assert( wxIsMainThread() );
>
> I would be in favour of the deprecation of implicit conversion of a
> function pointer to bool -- although maybe that would break too much code.
Compilers already warn about this being an always-true condition.
https://gcc.godbolt.org/z/ord8vsPMW
Clang says "address of function 'wxIsMainThread' will always evaluate to
'true'" and suggest you either add & or (). GCC says "the address of 'bool
wxIsMainThread()' will never be NULL" but is missing the suggestion. MSVC just
complains that you're narrowing from a pointer to a boolean, which isn't the
best warning, but still is a warning.
I do think deprecating the decaying of functions to function pointers is the
correct solution, but the chance of this happening before the entropy death of
the universe are pretty slim.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel DCAI Platform & System Engineering
Received on 2025-05-12 20:27:28