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

Search this archive.

From: Niels Hald Pedersen (nhp@FORCE.dk)
Date: Wed 01 Dec 1999 - 13:10:53 IST


The preprocessor handles strings, so it inserts "(3*4)".

The compiler, if smart enough, identifies 3*4 as a constant subexpression
and replaces it with 12 (If is _really_ dumb, it may assume that operators
are all alike and may all be handled as addition, thus replacing it with a
7).

regards

Niels HP,
nhp@force.dk

> -----Original Message-----
> From: Clive Crous [mailto:ccrous@shoprite.co.za]
> Sent: 1. december 1999 11:53
> To: linux-svgalib@vger.rutgers.edu
> Subject: [OT] Fixed Point Math ( was Re: semicircle )
> 
> 
> 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
> 
> thanks again
>     Clive
> 
> 
> 


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