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
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 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
Lite-C error (machine code generator:...) #132467
05/28/07 13:09
05/28/07 13:09
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline OP
Serious User
Claus_N  Offline OP
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Hi,

I have just installed Lite-C, so I'm very new to this =)

I am getting this error:


Here is the code:
Code:
TYPEVAR INVIsAllowed(RPGInventory* Inv,RPGItem* Item)
{
return(Inv->AllowedItems & Item->ItemType);
}


AllowedItems and ItemType are both of the type "short" (defined as TYPEVAR).

I bet the problem might be the &-operator - isn't it available in Lite-C??

EDIT:
This works neither:
Code:
TYPEVAR INVIsAllowed(RPGInventory* Inv,RPGItem* Item)
{
TYPEVAR tmp = Inv->AllowedItems & Item->ItemType;
return(tmp);
}


The error occurs at the return-line.

Last edited by Claus_N; 05/28/07 13:11.
Re: Lite-C error (machine code generator:...) [Re: Claus_N] #132468
05/28/07 22:52
05/28/07 22:52
Joined: Oct 2002
Posts: 254
UK, London
Dyc Offline
Member
Dyc  Offline
Member

Joined: Oct 2002
Posts: 254
UK, London
After doing a quick test I get the same error.

Code:
typedef short TYPEVAR;

TYPEVAR test()
{
return 1;
}



However defining TYPEVAR as an int gives no error.



Code:
typedef int TYPEVAR;

TYPEVAR test()
{
return 1;
}


So I would suggest that the problem lies in the compiler.

Re: Lite-C error (machine code generator:...) [Re: Dyc] #132469
05/29/07 07:48
05/29/07 07:48
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Functions return their values through the EAX register, which is 4 bytes. So a function can't return a short or a char. Shorts and chars are normally used for storing low-precision values or text, but not for number calculation.

So, you'll normally use

int INVIsAllowed(RPGInventory* Inv,RPGItem* Item)
{
return(Inv->AllowedItems & Item->ItemType);
}

However I'll implement short and char return in one of the next updates for compatibility reasons.

Re: Lite-C error (machine code generator:...) [Re: jcl] #132470
05/29/07 12:38
05/29/07 12:38
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline OP
Serious User
Claus_N  Offline OP
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Now it works, thanks!

I have not used Lite-C much yet, but so far it looks very promising. I love it!


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