Macros

Discuss PocketC for Palm OS (including Desktop Edition)

Postby nomar on Sun May 06, 2001 11:50 am

I am having trouble with macros. Can someone explain what they are, how they work, how to use them, and give me examples?

Thanks
nomar
 
Posts: 28
Joined: Thu Apr 19, 2001 11:20 pm

Postby wossname on Sun May 06, 2001 2:29 pm

A macro is a bit of code that the pre-processor reads while it compiles your applet.

For example:

#define Pi 3.14159

if you enter that into the header of your program, then every time the compiler finds "Pi" in your code, it substitutes "3.14159" in its place, making it easier to write certain bits of code.

#ifdef, #ifndef etc are more complex but in a nutshell, they tell the compiler to omit certain areas of code and include others in the final program depending on what has already been defined.




Wossname :)
Wossname :)
Are you <i>local</i>?
wossname
 
Posts: 275
Joined: Sat Feb 24, 2001 7:18 am

Postby nomar on Sun May 06, 2001 6:13 pm

Thanks <img src=icon_smile.gif border=0 align=middle>
nomar
 
Posts: 28
Joined: Thu Apr 19, 2001 11:20 pm


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests

cron