Author Topic: Small issue with fixed integer formats  (Read 133 times)

Offline manusalgueiro84

  • Single posting newcomer
  • *
  • Posts: 1
Small issue with fixed integer formats
« 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)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6983
    • My Best Post
Re: Small issue with fixed integer formats
« Reply #1 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

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.



« Last Edit: September 14, 2020, 06:17:24 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org