C or C++?

Jim Kuzdrall gnhlug at intrel.com
Fri May 27 18:00:01 EDT 2005


>>On 5/27/05, Bill Sconce wrote:
> If it were me I'd go with C++.  C++ allows better commenting.

   One concern is setting (and clearing) the microprocessor's interrupt 
mask in C++.  The code contains processes should not be interrupted 
during a critical step.  Some compilers are strict (or poorly designed) 
and fuss a lot about fooling with the processor.

   The code I use in C (and something for C++) usually spoofs the 
compiler and demonstrates your valid point about the superiority of C++ 
commenting.

  /* set interrupt mask */
  (*((void (*)())"\220\373\220\313");

  // I programmed this mask thing on my 41st birthday!
  // the guys threw a nice party
  // the first \220 thing isn't needed maybe
  // the last char is a ; which you just gotta do
  (*((void (*)())"\220\373\220\313");

   I haven't seen much tricky code in C or C++.  Programmers just 
usually plug along with code sequences they were taught in their 
programming classes.

Jim



More information about the gnhlug-discuss mailing list