Gamestudio Links
Zorro Links
Newest Posts
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Training with the R bridge does not work
by Petra. 11/15/25 09:31
Zorro 2.70
by jcl. 11/15/25 08:43
Camera always moves upwards?
by NeoDumont. 11/14/25 16:32
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 8,527 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
tritom, sheliepaley, Blueguy, blobplayintennis, someone2
19178 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,030
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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