Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, AndrewAMD, TedMar), 837 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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