Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    421523

Untitled

Sign in to follow this  
Evil Steve

63 views

Good one, CodeWarrior:
Quote:
Warning : implicit arithmetic conversion from 'int' to 'unsigned char'
gaSimulationTrackSel.cpp line 468 >setSuperPaletteOfs(m_pTopMap->getSuperPaletteOfs() == 0 ? 8 : 0);
getSuperPaletteOfs() returns an unsigned char.

WHERE, CODEWARRIOR? WHERE IS THE INT? I SEE NO INTS?
Solution:

m_pTopMapNext->setSuperPaletteOfs((u8)(m_pTopMap->getSuperPaletteOfs() == 0 ? 8 : 0)); // Shut the f*** up, Codewarrior





*gets back to work*
Sign in to follow this  


4 Comments


Recommended Comments

Seems fairly straight-forward (in a twisted compiler-error sort of way) to me [razz]

The numerical literals (0, 8) are assumed to be 'int' even though there shouldn't be any problem converting them to 'unsigned char'. Or something like that - the literals being the problem and not the function call.

Share this comment


Link to comment
Quote:
Original post by jollyjeffers
Seems fairly straight-forward (in a twisted compiler-error sort of way) to me [razz]

The numerical literals (0, 8) are assumed to be 'int' even though there shouldn't be any problem converting them to 'unsigned char'. Or something like that - the literals being the problem and not the function call.
But then you shouldn't be able to do unsigned char p = 42;. I'm just going to fight CodeWarrior...

Share this comment


Link to comment
That seems like a normal warning. Of course you see ints, you have the 8 and 0 in there.

Though, most compilers are smart enough to compile an integral literal the correct way, so when you do char x=8 and int x=8, they would recognize the 8's as different binary representations. I guess CodeWarrior is not one of them [grin]

Share this comment


Link to comment
A static cast would probably take care of that compile error. GCC acts very strange around unsigned char and normal char literals, too.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now