Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/20/26 15:57
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
ZorroGPT
by TipmyPip. 04/08/26 17:08
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (TipmyPip, Grant, AndrewAMD), 3,498 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
juergenwue, VladMak, Geir, ondrej, mredit
19208 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