Thursday, January 19, 2006

Structures

On a related note, in C, structs are very under-utilized. Most C compilers
carry no overhead for referring to a member of a structure structs are just
as efficient to access as simple variables. But structs provide two
important benefits over simple variables:
1. They provide an indication of grouping and association.
2. They automatically provide a sort of constricting syllables way of
naming things. In fact, member names can actually be simpler to invent,
because they can depend on the parent for some of the description.

For instance, consider motor.velocity.change and motor.velocity.old. The
final member name is not particularly descriptive, but the name as a whole
works very well because of the structure of parents. It is obvious that
these are related things, because they are part of the same structure
Volatile

Needed For:
  • Prevent optimization when reading from a memory mapped device registers
  • Delay Loops

Usage :
volatile int xyz;
or
int volatile xyz;

Note :
volatile may cause inefficient code. e.g the following code

hwReg &= ~FUNCTION_MASK;
hwReg |= FUNCTION_BIT;

instead use the following code

hwReg = (hwReg & ~FUNCTION_MASK) | FUNCTION_BIT;
Fortune 100 List of "Best Companys to work for"

Highlights for Local Bay Area Companies
  • Cisco Systems
    • Most common job (salaried) Software Engineer $131,580
  • Network Appliances
    • Most common job (salaried) Software Engineer $128,317
  • Yahoo
    • Most common job (salaried) Technical Yahoo, Senior $117,245
The complete california list is at

http://money.cnn.com/magazines/fortune/bestcompanies/state/C.html

Wednesday, January 04, 2006