Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Nymphodora, AndrewAMD, TipmyPip, Quad, Imhotep), 847 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
assert #477358
06/19/19 14:50
06/19/19 14:50
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Hi,

how to realize macro assert?

Code
#define ASSERT(expr) if (!(expr)) printf("\nError at line: %d ", __LINE__)


how to get a line in script?

thanks

Last edited by Grat; 06/19/19 14:50.
Re: assert [Re: Grat] #477360
06/19/19 14:59
06/19/19 14:59
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
There is no __LINE__ in lite-C, but the rest of the assert macro should work.

Re: assert [Re: Grat] #481504
09/22/20 12:14
09/22/20 12:14
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
if anybody want

Code
#include <profile.c>
#define assert(expr,line) if (!(expr)) printf("\nError at line: %d ", line)

// ------
int myDEF_ERR=0;
// -- ALFA --------------
#define ALFA 1

// -- BETA --------------
#define BETA 1
// --- control  
    #ifdef ALFA 
    #ifdef BETA
        myDEF_ERR = 1;
    #endif
    #endif

// -- GAMA --------------


void main(){
    assert(myDEF_ERR>0,22);
}


this code produce:
Quote


protoGen compiling............... ok

Error at line: 22


Last edited by Grat; 09/22/20 12:15.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1