View Single Post
  #7   Spotlight this post!  
Unread 07-02-2004, 19:10
Jeff McCune's Avatar
Jeff McCune Jeff McCune is offline
Alpha Geek
#0677 (The Wirestrippers)
Team Role: Mentor
 
Join Date: Jan 2003
Location: The Ohio State University
Posts: 67
Jeff McCune is on a distinguished road
Send a message via ICQ to Jeff McCune Send a message via AIM to Jeff McCune
Re: Compiler Help Needed

As an example, when using a microcontroller, using this:

#define PI (22 / 7)

is *considerably* faster than using 3.14159... and it gives a fairly decent approximation.

Also, to prevent re-inclusion of header files, people usually do something like this:

myheader.h
#ifndef MYHEADER_H
#define MYHEADER_H

.. Entire header file ...

#endif
/* ifndef MYHEADER_H */

This prevents weird recursion problems from having a header file included twice at the top of a C file.

It's sloppy, and I don't recommend doing this, because if you *need* to do this, you're already down the dangerous road they've been speaking of and you ultimately need to fix that or you'll just have a *monstrous* headache at competition when you're rapidly changing code.
__________________
Team 677 - The Wirestrippers - Columbus School for Girls and The Ohio State University
EMAIL: mccune@ling.ohio-state.edu

...And all you touch and all you see
Is all your life will ever be...