Advertisement

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

Started by November 06, 2016 10:43 PM
3 comments, last by WitchLord 8 years 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.

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

Advertisement

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