News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Small issue with fixed integer formats

Started by manusalgueiro84, September 13, 2020, 03:08:27 AM

Previous topic - Next topic

manusalgueiro84

Hi everyone,

  I have a small issue with fixed integer formats in scanf. Whenever I try to read an uint8_t, using the %hhu format, I get this warning:

warning: unknown conversion type character 'h' in format [-Wformat=]| (Seems like is not recognizing the format)

The code is:

uint8_t codigo = 0;

scanf("%hhu", &codigo);



(Using CodeBlocks 20.03 in Windows 10 x64)

stahta01

#1
That is a warning from the Compiler! Code::Blocks is not a Compiler!

Post the full build log in code tags and someone might see the problem.

Post information about your Compiler in case that matters.

Link on how to post in code tags
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Note: Adding option "-Wno-format" might disable the warning.
Project -> Build Options
Tab: Compiler Settings
Subtab: Other compiler options

Edit: Googling implies that old versions of MinGW GCC did not support "%hhu". No idea if new versions do support it.

Tim S.



C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]