Gamestudio Links
Zorro Links
Newest Posts
FXCM => AVA Trade Plugin???
by Martin_HH. 11/17/26 17:02
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
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (AndrewAMD, Martin_HH, 1 invisible), 30,616 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rht, MaliceTheMaker, Haitao_Ren, JimSimons, julienp
19249 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Function returning a short #134712
06/08/07 10:18
06/08/07 10:18
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline OP
Expert
Excessus  Offline OP
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
I'm trying to create a function that should return a short. Here is my test code:

Code:

short testfunc()
{
return 100;
}
int main()
{
testfunc();
}



This results in an error:
Quote:

Error in 'MAIN' line 55: machine code generator: cannot translate SETRETV:::SHORT
< return 100; >





Am I doing something very stupid?

The manual says this:
Quote:

While C-Script can only return a var, lite-C, C, or C++ can return any variable or pointer type. Instead of "function", the function is then defined with the returned type, like float, ENTITY*, or whatever.




Re: Function returning a short [Re: Excessus] #134713
06/08/07 11:01
06/08/07 11:01
Joined: Jul 2000
Posts: 28,149
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,149
Frankfurt

Re: Function returning a short [Re: jcl] #134714
06/08/07 14:18
06/08/07 14:18
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline OP
Expert
Excessus  Offline OP
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Thank you, I'll use an int for now.

I noticed another quirk, although it might also have been reported before (couldn't find anything though):
Code:

// Works:
char chr = 5;
short shrt = chr;

// Fails:
char chr = 5;
short shrt = (short)chr;



The second piece of code gives me a "Cannot translate CONV:CHAR::SHORT" error. Kinda strange since implicit casting (without "(short)") seems to work fine.


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