This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

%bu vs. %hu in printf()

I am using simultaneously in the 8bit C51 and 16bit compilers for two related projects.

Am I correct that for 8bit integers,
8-bit compiler uses %bu in printf()
16bit compiler uses %hu
?
Shouldn't they work the same, and accept either modifier?

Thank you.

Parents
  • "C51 manual pg 288:
    mentions L and B modifiers, but does not explicitly indicate size."


    What's the date on your manual?
    Mine's 09.2001, and p291 says:
    "The optional characters b or B and l or L may immediately precede the type character to respectively specify char or long versions of the integer types d, i, u, o, x, and X."

    Although not explicitly stated in that very paragraph, the Manual clearly tells you that char is 8 bits, int is 16 bits, and long int is 32 bits.

    Online manual:
    "The optional characters b or B and l or L may immediately precede the type character to respectively specify char or long versions of the integer types d, i, u, o, x, and X."
    http://www.keil.com/support/man/docs/c51/c51_printf.htm

    Seems clear enough to me?

Reply
  • "C51 manual pg 288:
    mentions L and B modifiers, but does not explicitly indicate size."


    What's the date on your manual?
    Mine's 09.2001, and p291 says:
    "The optional characters b or B and l or L may immediately precede the type character to respectively specify char or long versions of the integer types d, i, u, o, x, and X."

    Although not explicitly stated in that very paragraph, the Manual clearly tells you that char is 8 bits, int is 16 bits, and long int is 32 bits.

    Online manual:
    "The optional characters b or B and l or L may immediately precede the type character to respectively specify char or long versions of the integer types d, i, u, o, x, and X."
    http://www.keil.com/support/man/docs/c51/c51_printf.htm

    Seems clear enough to me?

Children
No data