Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 636 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
question about wmp_load.c example in wmpmdlSDK #247088
01/18/09 23:14
01/18/09 23:14
Joined: Dec 2003
Posts: 521
LazyDog Offline OP
User
LazyDog  Offline OP
User

Joined: Dec 2003
Posts: 521
in the load_block function, the following code:

if ( wmpTexture->tex_flags)
{
printf("texture_flags: %d,%d\n", wmpTexture->tex_flags);
}

how does this output 2 values when you are only providing one variable which is tex_flags?


www.LazyDogSoftware.com
Delphi SDK Homepage

A7 Pro 780
Delphi 5 through 2010
Re: question about wmp_load.c example in wmpmdlSDK [Re: LazyDog] #247122
01/19/09 07:27
01/19/09 07:27
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
That's apparently a bug - please remove the superflous "%d" from printf.

Re: question about wmp_load.c example in wmpmdlSDK [Re: jcl] #247203
01/19/09 13:46
01/19/09 13:46
Joined: Dec 2003
Posts: 521
LazyDog Offline OP
User
LazyDog  Offline OP
User

Joined: Dec 2003
Posts: 521
Actually, your binary version of wmp_load.exe in the samples directly does write 2 values out. when I ran it against a small test level it reported 8192,7


www.LazyDogSoftware.com
Delphi SDK Homepage

A7 Pro 780
Delphi 5 through 2010
Re: question about wmp_load.c example in wmpmdlSDK [Re: LazyDog] #247226
01/19/09 15:20
01/19/09 15:20
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Sure, printf prints 2 values because it was told so. In our programmer job interviews, one of the questions is:

What happens when you have the line

printf("%d");

in your C/C++ code? Will it a) give a compiler error, b) crash, or c) print a value - and if so, which one?

When you can answer this question in a job interview, you have a chance to get hired by Conitec.

Re: question about wmp_load.c example in wmpmdlSDK [Re: jcl] #247271
01/19/09 19:04
01/19/09 19:04
Joined: Dec 2003
Posts: 521
LazyDog Offline OP
User
LazyDog  Offline OP
User

Joined: Dec 2003
Posts: 521
the answer is c) and the value is undefined-- it depends on what is in memory for that variable at that time.

so am I'm hired?

I just wanted to make sure that instead of removing the second %d that perhaps the problem was that the author of wmp_load.c (if that was not you) simply forgot to actually add the second variable. I now realize that indeed, the second %d was not meant to be there and it should be removed.

thanks


www.LazyDogSoftware.com
Delphi SDK Homepage

A7 Pro 780
Delphi 5 through 2010
Re: question about wmp_load.c example in wmpmdlSDK [Re: LazyDog] #247329
01/20/09 08:37
01/20/09 08:37
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You'd be almost hired. The value is not undefined - it's the last local variable of the printf calling function. That's because functions take their parameters from the stack and local variables are also stored there. You can safely remove the second "%d".


Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | 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