At first, Adam Quinn was a bit confused to see expressions like "repeat until(freq LT testFreq)" in the C application he was maintaining. But after a little bit of digging, he was thrilled to find the secret to "Better C" buried in an appropriately named header file.

As tempted as I was to hoard this secret for myself, I feel an obligation to share such things with my fellow programmers. Now that this well-kept "Better C" secret is in the public, I suspect there will be nothing short of a complete revolution in the world of C programming. Say goodbye to the C that you know and welcome your new best friend, "Better C" ...

/*
 * BETTER_C.H   
 * Language refinements for C. 
 */
#ifndef BETTER_C_H
#define BETTER_C_H

/* logical/comparison operators */
#define NE  !=
#define EQ  ==
#define GT  >
#define LT  <
#define GE  >=
#define LE  <=
#define AND &&
#define OR  ||
#define NOT !

/* bitwise operators */
#define bNOT ~
#define bAND &
#define bOR  |
#define bXOR ^

/* arithmetic operators */
#define MOD   %

/* control constructs */
#define repeat    do
#define until(p)  while(NOT (p))
#define forever   while(1)
#define untilbreak  forever
#define untilreturn forever
#define unless(p) if(NOT (p))
#define ifnot(p)  if(NOT (p))
#define do_nothing
#define then

...

#endif
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!