code crashes in release build
category: code [glöplog]
hi everyone,
I'm encountering a strange problem in my C++ project in which it crashes / wont work properly in release mode....
could someone please help? I've marked the spot that might be the problem in main.cpp
http://rghost.net/private/46084460/e2c63a4e130301e79cf4500e0be51480
I'm encountering a strange problem in my C++ project in which it crashes / wont work properly in release mode....
could someone please help? I've marked the spot that might be the problem in main.cpp
http://rghost.net/private/46084460/e2c63a4e130301e79cf4500e0be51480
first bug:
Code:
char xmlist[][MAX_PATH]={"pk_lemming.xm", "pk_lz0_12.xm", "pk_lz0_14.xm", "pk_orgie.xm"\
"pk_sleepless.xm", "pk_stn.xm"};
It's 2013. I guess your inline assembly stuff might be somewhat error prone.
Maybe it's RandomInt()... I don't see why exactly you need inline assembly for what you are doing.
Try to replace all asm-codeparts with proper C/C++ code - I see nothing in your asm code which the compiler wouldn't optimize better than you did.
Well and given that I only have a 2012 Ultimate here - I only had a rough look at it. Get rid of all the unnecessary asm-parts and ask again.
Maybe it's RandomInt()... I don't see why exactly you need inline assembly for what you are doing.
Try to replace all asm-codeparts with proper C/C++ code - I see nothing in your asm code which the compiler wouldn't optimize better than you did.
Well and given that I only have a 2012 Ultimate here - I only had a rough look at it. Get rid of all the unnecessary asm-parts and ask again.
las: it is RandomInt() - there's no MSB / sign check so it occasionally returns negative :)
replace with
and it works fine.
replace with
Code:
unsigned int RandSeed[2] = {0x0A2F59C2,0x05B2A10E9};
/* code */
unsigned int RandomInt(int RNGRange)
{
RandSeed[0] += 0x3b1c62e9;
return RandSeed[0] % RNGRange;
}
and it works fine.
Why doesn't it crash in debug mode as well?
Quote:
Why doesn't it crash in debug mode as well?
have you ever done any actual programming or?
Quote:
Why doesn't it crash in debug mode as well?
Usually because you don't initialize some variables.
ok, all fixed :) thanks
For what it's worth, I also recommend getting rid of the inline assembler. With this kind of code, it's totally useless.
well, I've ported almost all the other functions to C....
C seems a lot better than asm indeed
C seems a lot better than asm indeed