Re: [OT] Fixed Point Math ( was Re: semicircle )

Search this archive.

From: Martijn van Oosterhout (kleptog@cupid.suninternet.com)
Date: Wed 01 Dec 1999 - 13:23:12 IST


Clive Crous wrote:
> 
> hmmmm
> 
> I thought #define's where "pre-processed"
> ie
> i want to do this:
> ---
> #define MYDEF (3*4)
> ---
> and when i use "MYDEF" in the code it must put in a "7" not a "(3*4)"
> is there a way to do this ?
> why should I have computations done at run time, when they could be done at
> compile time

#defines do exactly what it says, simple substitutions, nothing more.
(I think it also replaces hex and oct constants with decimal).

The 3*4 will be replaced by 12, but the compiler will do that, not
the preprocessor.

Martijn


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:22 IST