🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

uint8 and uint16 constants cause compile-time assertion failure on type conversion to signed types.

Started by
3 comments, last by WitchLord 7 years, 7 months ago

Sample code #1:


const uint8 foo = 0;
int bar = foo; 

Sample code #2:


const uint16 foo = 0;
void bar(int16) {}
void main() {
	bar(foo);
}

The assertion failure happens when function asCCompiler::ImplicitConversionConstant calls asCExprValue::GetConstantDW, which expects a type of exactly 4 bytes in size.

Advertisement

Thanks. These asserts were included to make sure the code properly supports big endian CPUs. Unfortunately some code was not properly endian agnostic.

Which version of AngelScript are you using? I have made some fixes in the latest WIP related to this already (though I will double check if the cases you report have indeed been fixed).

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

We use r2351. I had viewed the repository and hadn't noticed any changes in the involved code but I could be wrong.

The last fix related to this problem was done in revision 2354, but that was for comparisons on boolean constants and probably doesn't fix the problems you identified.

I'll come back with a fix as soon as possible.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've fixed this in revision 2359.

Thanks,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement