Welcome!

Final Burn Neo => FBN Development => Topic started by: barbudreadmon on October 21, 2016, 06:48:22 AM

Title: Using "char" instead of "signed char" seems bad for portability
Post by: barbudreadmon on October 21, 2016, 06:48:22 AM
Is there a reason why you don't use the following typedef defined in burn.h everywhere it applies :
Code: [Select]
typedef unsigned char UINT8;
typedef signed char INT8;
typedef unsigned short UINT16;
typedef signed short INT16;
typedef unsigned int UINT32;
typedef signed int INT32;
typedef signed __int64 INT64;

My main issue is that sometimes, "char" is used as an alias of "signed char", but that's wrong on some platform (on arm, "char" is a "unsigned char"). I think replacing every "char" by "INT8" in fba (if you think it's failsafe ?) could improve portability of fba.

See this post (http://"http://http://neo-source.com/index.php?topic=2693.msg22373#msg22373")
Title: Re: Using "char" instead of "signed char" seems bad for portability
Post by: Barry Harris on October 21, 2016, 08:02:38 AM
Is there a reason why you don't use the following typedef defined in burn.h everywhere it applies :
Code: [Select]
typedef unsigned char UINT8;
typedef signed char INT8;
typedef unsigned short UINT16;
typedef signed short INT16;
typedef unsigned int UINT32;
typedef signed int INT32;
typedef signed __int64 INT64;

My main issue is that sometimes, "char" is used as an alias of "signed char", but that's wrong on some platform (on arm, "char" is a "unsigned char"). I think replacing every "char" by "INT8" in fba (if you think it's failsafe ?) could improve portability of fba.

See this post (http://"http://http://neo-source.com/index.php?topic=2693.msg22373#msg22373")

Agreed. The whole burn library and cpus, etc. were updated to this a while ago. Newer submissions may need updating though. Feel free to provide patches against the latest release source.
Title: Re: Using "char" instead of "signed char" seems bad for portability
Post by: iq_132 on October 21, 2016, 12:00:00 PM
I don't go through large blobs of code that I port and change these. For sure the NEC core bug was my fault :*/.
Title: Re: Using "char" instead of "signed char" seems bad for portability
Post by: barbudreadmon on November 02, 2016, 07:16:56 AM
Fixing everything will be hard, because a change in a file call for another change in another file, and i can't really provide one full patch for everything, it would be a pain in the ass for everyone :).

For now i can at least tell you this one is needed (d_cclimber.cpp) :
http://pastebin.com/raw/cXgB6rKE

fba on arm won't build with gcc-6.X without it
Title: Re: Using "char" instead of "signed char" seems bad for portability
Post by: barbudreadmon on November 02, 2016, 07:23:33 AM
Also, while fixing this one, i was wondering what's your current standard for twinstick game inputs ? I have seen some game using "p(X+2) <direction>" for second stick, and some other using "pX <direction> 2" (i think the second one is better). I'm interested in having the same standard for all those games, so i could provide you a patch to normalize this.
Title: Re: Using "char" instead of "signed char" seems bad for portability
Post by: dink on November 02, 2016, 07:23:56 PM
Thanks for the cclimber patch, it's been integrated.

re: dual stick games, I'm with you on the second option as well.

re: sbm, fsoccerb & fsoccerba: marked as unworking for now.

best regards,
- dink
Title: Re: Using "char" instead of "signed char" seems bad for portability
Post by: danielt3 on November 22, 2016, 03:00:14 PM
Actually it is much better to use the following types: uint8_t, uint32_t, etc. These are readly avaliable from stdint.h in standard C library. I will try to make a patch against 0.2.97.39 sources.