Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: manusalgueiro84 on September 13, 2020, 03:08:27 am

Title: Small issue with fixed integer formats
Post by: manusalgueiro84 on September 13, 2020, 03:08:27 am
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)
Title: Re: Small issue with fixed integer formats
Post by: stahta01 on September 13, 2020, 03:51:08 am
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 (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.