Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Multiline macros #268669
05/30/09 15:11
05/30/09 15:11
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Hello,

does somebody know how or if multiline macros can be used in lite-C?

I neither found any explicit info about this in the manual nor on the forums.

Code:
/* works */
#define TEST_MACRO(a,b) ((a)*(b)) 

/* does not work
   compiler error: 'a' undeclared identifier */
#define TEST_MACRO(a,b) \
((a)*(b)) 


Re: Multiline macros [Re: Saturnus] #268696
05/30/09 18:10
05/30/09 18:10
Joined: Jan 2004
Posts: 2,062
Hamburg, Germany
slacer Offline
Expert
slacer  Offline
Expert

Joined: Jan 2004
Posts: 2,062
Hamburg, Germany
No, I tried it the way it should be - like in your example, but it did not work.

Re: Multiline macros [Re: slacer] #268757
05/31/09 00:09
05/31/09 00:09
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Large macros are VERY in-efficient.
Multi-line macros are a scary thought.
Can you post the actual macro you are trying to split?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Multiline macros [Re: EvilSOB] #268761
05/31/09 01:43
05/31/09 01:43
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
There isn't any specific macro.

I just wanted to test how well macros would be suited for doing some generic programming in lite-C without using void pointers.

Something like this, for example:
Code:
// dynamic array of specific type
#define CREATE_VECTOR(type)    \
typedef struct VECTOR_##type { \
        int size, count;       \
        type *data;            \
} VECTOR_##type ;

Using void* is ok for me in most cases.
However, it gets impractical when dealing with primitive data types like int.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1