Jump to content
  • Advertisement
Sign in to follow this  
Sir Ementaler

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

This topic is 680 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Edited by Sir Ementaler

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!