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

Code contains birnay number

I have a question on Uvsion2 IDE.
I read a Quick start manual on page 111.
It indicates that the compiler accepts
binary constant number. When I used it
on my code, the compiler did not seem to take
it. Could somebody tell me what I did
wrong here.


Here is the short test code:

char number;
main(void)
 {
  number = 111111y;   //binary number
 }

  • The manual section you speak of refers to the uVision2 Debugger--Not the C Compiler.

    Jon

  • [rant]
    Given the nature of the 'C' language, its areas of application, and the fact that it does have bitwise operators, it's always struck me as a glaring omission that it has no native way to write a number in binary notation!

    Even more surprising is that I've never even seen any compiler come up with a proprietary extension to allow this - I've seem all sorts of other weird & wonderful extensions, but never binary notation.

    Why ever not?!
    [/rant]

  • "Even more surprising is that I've never even seen any compiler come up with a proprietary extension to allow this - I've seem all sorts of other weird & wonderful extensions, but never binary notation."

    HI-TECH's compilers support binary notation in the form of a "0b" prefix, which is used like the "0x" hexadecimal prefix you are familiar with.