Date: Wed, 26 Feb 2020 14:52:15 -0500 From: George Mitchell <george+freebsd@m5p.com> To: freebsd-hackers@freebsd.org Subject: Re: FreeBSD raspberry pi C compiler strangeness Message-ID: <4719d54b-d2df-e333-6023-869a3e5a562f@m5p.com> In-Reply-To: <alpine.BSF.2.20.2002262043150.32598@puchar.net> References: <alpine.BSF.2.20.2002262043150.32598@puchar.net>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --c5O4SWNqSVbk8MPOvcVhKGv4ob2EiyxSS Content-Type: multipart/mixed; boundary="cXUVnWJFVCYLVeQ23Srf0J5tu9XT06eoR"; protected-headers="v1" From: George Mitchell <george+freebsd@m5p.com> To: freebsd-hackers@freebsd.org Message-ID: <4719d54b-d2df-e333-6023-869a3e5a562f@m5p.com> Subject: Re: FreeBSD raspberry pi C compiler strangeness References: <alpine.BSF.2.20.2002262043150.32598@puchar.net> In-Reply-To: <alpine.BSF.2.20.2002262043150.32598@puchar.net> --cXUVnWJFVCYLVeQ23Srf0J5tu9XT06eoR Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2020-02-26 14:45, Wojciech Puchar wrote: > i wrote my program and tested completely my program on x64 laptop under= > FreeBSD 11 >=20 > then i compiled this program under FreeBSD on raspberry pi (quite lates= t > version downloaded less than 2 months ago). >=20 > And program didn't work properly. >=20 > Finally i found a problem. >=20 > char is signed by default on x64. >=20 > On raspberry pi char is unsigned by default. > replacing "char" with "signed char" fixed problem completely. >=20 > Why char is unsigned on FreeBSD/raspberry pi? > [...] Because the C standard explicitly doesn't say. The standard DOES explicitly say that char, signed char, and unsigned char are considered to be three distinct types, no two of which are necessarily comparable. The bottom line is that you are asking for trouble by ever specifying "char" as a type, and you should always specify either "signed char" "unsigned char" as appropriate for the given situation. -- George --cXUVnWJFVCYLVeQ23Srf0J5tu9XT06eoR-- --c5O4SWNqSVbk8MPOvcVhKGv4ob2EiyxSS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEENdM4ZHktsJW5kKZXwRES3m+p4fkFAl5WzG8ACgkQwRES3m+p 4fnb0hAAv/XIEmlxj+rcI+6P5vBmZgiDpDHHt/T5rNsJJ+vETWFR+bWzagwPGbkY LwIrdSpIbK47OuP28VqZHybKhUOCc5P1v+ClTbJhBrKOY5BOBX69plvjhNiocPky tQ9Q+q6M0FzoBHY7xaLRmQF6Io3iRvEtCGTfUCpRTlxbU0T3HEVn/muQwuv1zCO5 zadxdEVRBx85FnFQpa9pkssVXPcEK1TxJNtMuuTYKcFf/NFLB9ICLdRw43aEUA4b fEZXuffmukfBC9uuwga+n1Uw0upOBVVvuD/fLdzkTZ3cSs08Tcm5SmAgYsvlEnVa Mc/ERVc2lZ59fMjXsnDIypi8yoXuZVLiQ6BnaKC5S8KwGLdpSEUdO3vGJxV15MiV 2rKXJ+gQ4J0y4f67aZRNUPZ/E9KChbsWEymepFUPlvfOLeUZffi9VZkKLUOhRnLq qQ419OPWXECLdVwEkhEtJDeOrL0U0DocZ3Sz8At/E49CL9PkoR/96GgQa7jtL7Ax oWWIIhXtCIR1O+xX/3sN5yAhf4PPJYYFu/y5pF3lR6pi/DoBkPDFrtcEcJ/PAFku FMxFeZ2Ogs1eTxonLKxj/3kVfxwCstkGw94gzVW1imMmdmPHDSxNKnXpOfISzFaN QUshly3cATwY+vv7+82gDjT5+dk2Wuedk3Ah68OrQ1fX760+Cpw= =LSIq -----END PGP SIGNATURE----- --c5O4SWNqSVbk8MPOvcVhKGv4ob2EiyxSS--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4719d54b-d2df-e333-6023-869a3e5a562f>