Skip to main content
ferro
Lead
Jan 7, 2025 11:08 AM UTC
Solved

Gfx 4.24.1, warning in CWRUtil::toQ5(T) [with T = float]

Dear Gfx Team,

CWRUtil::toQ5 causes Cube compiler giving this warning

c:\TouchGFX\4.24.1\touchgfx\framework\include\touchgfx\widgets\canvas\CWRUtil.hpp

 

../touchgfx/widgets/canvas/CWRUtil.hpp: In instantiation of 'static touchgfx::CWRUtil::Q5 touchgfx::CWRUtil::toQ5(T) [with T = float]':
../touchgfx/widgets/canvas/Canvas.hpp:120:36: required from here
../touchgfx/widgets/canvas/CWRUtil.hpp:518:31: warning: arithmetic between floating-point type 'float' and enumeration type 'touchgfx::Rasterizer::<unnamed enum>' is deprecated [-Wdeprecated-enum-float-conversion]
 518 | return Q5((int)(value * Rasterizer::POLY_BASE_SIZE));
 | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 

Could you possibly cast Rasterizer::POLY_BASE_SIZE to the static_cast<T> :

 

static Q5 toQ5(T value)
{
 return Q5(static_cast<int>(value * static_cast<T>(Rasterizer::POLY_BASE_SIZE)));
}

 

 

ferro_0-1736248095880.png

 

What do you think ?

 

This topic has been closed for replies.
GaetanGodart
GaetanGodartBest answer
ST Employee
Jan 7, 2025 1:06 PM UTC

Hello @ferro ,

 

Thank you for your feedback!
I will report it to the team and I will keep you updated.

I am personally unaware of this function, can you tell me in which file it is located?

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)

5 replies

GaetanGodart
GaetanGodartBest answer
ST Employee
Jan 7, 2025 1:06 PM UTC

Hello @ferro ,

 

Thank you for your feedback!
I will report it to the team and I will keep you updated.

I am personally unaware of this function, can you tell me in which file it is located?

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)
ferro
ferroAuthor
Lead
Jan 7, 2025 1:29 PM UTC

Hi @GaetanGodart 

"can you tell me in which file it is located?"

c:\TouchGFX\4.24.1\touchgfx\framework\include\touchgfx\widgets\canvas\CWRUtil.hpp

 

GaetanGodart
ST Employee
Jan 7, 2025 1:32 PM UTC

Thank you @ferro !

Gaetan GodartSoftware engineer at ST (TouchGFX)
GaetanGodart
ST Employee
Feb 3, 2025 9:59 AM UTC

Hello @ferro ,

 

It seems we have implemented the change.
It should be available now or in the next release coming soon.

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)
ferro
ferroAuthor
Lead
Feb 5, 2025 9:03 AM UTC

Lovely. MSVC C++17 does not complain but MSVC and CubeIDE C++20 does so nice its sorted @GaetanGodart .