The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Random C pre-processor question. by LionsPhil2004-12-19 13:25:44
  Since the preprocessor doesn't do math... by Tars_Tarkas 2006-11-19 12:55:59
...only text replacement, that will become an expression containing something multiplied by 256.

However the preprocessor will expand until it cannot expand any further:

#define F(A) (A * A)
#define G F

then

G(2);
a = G;

will become

F(2 * 2);
A = F;

which, like that, isn't gonig to compile, but the preprocessor doesn't know that.

It will however avoid choking on something like:

#define A B
#define B A

The preprocessor is a strange strange thing...
(see also the examples in this nice document: n869.pdf.gz around page 155)
--
Tars Tarkas, Holder of Opinions and Views, Sayer of Sayings, Humblest of the Humble, most Knowledgable Person.
[ Reply ]

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)