TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: Paul Edwards
date: 1996-10-26 08:44:22
subject: #defines

FA> I'm trying to refer to a memory location, and define two similar functions 
FA> according to the value in there.
FA> I know a couple of other ways to do it, but i was trying to go..

FA> #define VAL *MK_FP(here,there) 

FA> #if(VAL)         
FA> #define func() func1() 
FA> #else 
FA> #define func() func2()
FA> #endif

FA> It looked good, but maybe i just can't compile until the compiler gets a 
FA> chance to compile ? :-) 

Yeah, you can't get the preprocessor to go and look at a memory location in
advance for you!  What you can do is define two functions, and then at
runtime, choose between them.  You do this with a function pointer, called
func(), and point it to either func1() or func2(). BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.