Hello,
when i compile several chess programs it seems to me, that alot of them have this tbcore.c file(s) 1:1 included. But there seems to be a problem on ARM gcc.
on my version on line 408 it saying:
static const char offdiag[] = {
but since there are "-1" inside, the arm gcc complains about "narrowing"
I think it should be:
static const signed char offdiag[] = {
or is there another way to get this compile error solved?
Thanks,
JÜrgen
tbcore.c problem on RaspPi
Moderators: hgm, Rebel, chrisw
-
- Posts: 34
- Joined: Thu Sep 28, 2017 6:52 pm
- Location: Karlsruhe, Germany
- Full name: Jürgen Précour
-
- Posts: 5557
- Joined: Tue Feb 28, 2012 11:56 pm
Re: tbcore.c problem on RaspPi
You are fully correct. It should have been signed char.
-
- Posts: 4366
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
-
- Posts: 2487
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: tbcore.c problem on RaspPi
On ARM, char is unsigned by default, while it is signed on x86. You can change this via a compiler flag (-fsigned-char for GCC).LocutusOfPenguin wrote:but since there are "-1" inside, the arm gcc complains about "narrowing"
Making the char signed in the declaration is a cleaner way of fixing it. But actually, char should not be used for anything besides characters. Since C99, the correct datatype here would be int8_t.