avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] Re: [avr-gcc-list] Re: What Happened to the sbi() and cbi


From: Brian Dean
Subject: [avr-libc-dev] Re: [avr-gcc-list] Re: What Happened to the sbi() and cbi() Macros????
Date: Tue, 1 Feb 2005 22:18:07 -0500
User-agent: Mutt/1.4.2.1i

On Mon, Jan 31, 2005 at 02:36:16PM -0700, E. Weddington wrote:

> Geez, you don't have to be a "guru" to understand this stuff. There
> are a class of operators in the C language that deal with bit
> manipulation.  They are a standard part of the language.

Seriously!

BTW, I think we are missing some additional "helper" macros.  What
about this:

  #define ASSIGN(var,val) var = val

Geez, we could rewrite the whole language like this :-)

  #define WHILE(cond,body) while (cond) { body }

Pretty cool, huh?

Why do we need macros that perform the same operation as a single C
operator?

  PORTB ^= 0x01; /* toggle bit */

Isn't that a lot easier to read and understand this:

  if (bit_is_set(PORTB, 1))
    cbi(PORTB, 1);
  else
    sbi(PORTB, 1);

???

If you are progamming in C, there's no getting around learning the
language.  You must learn the syntax and available operators otherwise
you will struggle along forever.

The arguments about removing the depricated macros, while at one time
might have had some sympathy, are coming way too late.  They have been
depricate for a number of _years_.  Surely you've known.

-Brian




reply via email to

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