ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] ARM Build

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 16 Oct 2014 15:19:36 -0700
On Oct 16, 2014, at 4:50 AM, Graham Bloice <graham.bloice@xxxxxxxxxxxxx> wrote:

> Visual Studio (VS2013 at least) as 32 & 64 bit ARM compilers.

	http://msdn.microsoft.com/en-us/library/0w6ke344.aspx

"Type char

Visual Studio 2013	Other Versions		1 out of 1 rated this helpful - Rate this topic

The char type is used to store the integer value of a member of the representable character set. That integer value is the ASCII code corresponding to the specified character.

Microsoft Specific

Character values of type unsigned char have a range from 0 to 0xFF hexadecimal. A signed char has range 0x80 to 0x7F. These ranges translate to 0 to 255 decimal, and –128 to +127 decimal, respectively. *The /J compiler option changes the default from signed to unsigned.*

END Microsoft Specific"

(emphasis mine, as that seems to implicitly indicate that an unqualified "char" is signed by default).

So, unless that page discusses *only* the x86-32/x86-64/Itanium-if-they-still-support-it compilers, it appears that char is signed by default on all platforms, presumably including ARM.

What we *could* do is, on some platform or platforms, do both default compiles and char-is-unsigned compiles, using /J for MSVC and -funsigned-char with GCC (and Clang?).

(I couldn't find any -W option for GCC that warns about code that would behave differently with char-is-signed and char-is-unsigned. There should be, but, then, there should also be an option to warn about *all* implicit shortenings - or, at least, all implicit shortenings that aren't known to be safe, such as converting "sizeof (int)" to a type shorter than size_t - even though there should be.)