Gamestudio Links
Zorro Links
Newest Posts
contractUpdate() is filtering if >2 rows
by mistery. 11/09/26 12:06
New Zorro version 3.15
by jcl. 11/09/26 09:24
Removing outliers from files
by jcl. 11/04/26 10:30
[MED] Import from FBX (2010) missing!!!
by rayp. 11/03/26 14:33
What are you working on?
by rayp. 11/02/26 13:57
No connection to MT4
by JeyKey II. 10/29/26 09:34
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (LoT, 1 invisible), 6,605 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
dabolong, MaliceTheMaker, Haitao_Ren, JimSimons, julienp
19249 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,147
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,147
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