[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Syntax : how to specifiy a binary constant ?

From: Derric Tubbs
Subject: Re: [avr-gcc-list] Syntax : how to specifiy a binary constant ?
Date: Thu, 22 Sep 2005 18:00:23 -0700 (PDT)

I may be wrong but I'm going to venture a guess here
that you can't write a binary literal in C.  I tried a
simple example with the syntax mentioned here on
standard GCC (non-AVR) and got the same error
mentioned.  I also looked around the net and found
nothing about how to do so.

It seems I remember seeing in one language or another
that you COULD represent binary literals but I've
tinkered in so many who knows which it was.  Probably

Is there some reason you can't specify your constant
as hex?  Hex is always a safe bet and is almost always
represented the same way in all languages.

I believe the original poster said he was new to
programming.  If so, just remember that each hex digit
represents four binary bits/digits with decimal values
of 0-15.  It won't take long at all to get where
reading hex, both for decimal value and bit pattern,
happens without thinking about it.


--- Vincent Trouilliez
<address@hidden> wrote:

> > GCC 3.4.3 must work for
> > 
> > foo = 0b11110000;
> >  OR
> > foo = 0B11110000;
> > 
> > Are you getting compilation errors?
> > 
> > Nayani
> Hi Nayani,
> Yes, I get a compiler error in both cases.
> About foo = 0b1111000; or foo = 0B11110000; it says
> :
> main.c:92:9: invalid suffix "b11110000" on integer
> constant
> ...and about foo = b11110000; it says:
> main.c:92: error: `b11110000' undeclared (first use
> in this function)
> Regards,
> --
> Vince
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]