Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

narrowing conversion when char is not signed #191

Closed
Zirias opened this issue Mar 31, 2020 · 2 comments
Closed

narrowing conversion when char is not signed #191

Zirias opened this issue Mar 31, 2020 · 2 comments
Assignees

Comments

@Zirias
Copy link
Contributor

Zirias commented Mar 31, 2020

Building fails on architectures with unsigned char like powerpc:

../../emu64-5.0.18/src/c64_class.cpp: In member function 'void 
C64Class::AnalyzeSDLEvent(SDL_Event*)':
../../emu64-5.0.18/src/c64_class.cpp:1760:46: error: narrowing conversion of '-1' from 'int' to 'char' [-Wnarrowing]
 1760 |     static char joy_axis_tbl[5] = {1,1,0,0,-1};
      |                                              ^
*** [c64_class.o] Error code 1

Suggestion: explicitly use unsigned char and signed char where appropriate.

Reported from: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245200

@ThKattanek
Copy link
Owner

Ok, I always assumed that char == unsigned char. But just checked my C / C ++ Reference again. ANSI does not specify whether char is signed or not. I will correct that, maybe I have used more of it. I'll go through everything. Thank you!

@ThKattanek ThKattanek self-assigned this Mar 31, 2020
ThKattanek added a commit that referenced this issue Mar 31, 2020
@ThKattanek
Copy link
Owner

this is fixed. I'll look at the rest of the source code tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants