Within both MS ABI and Itanium ABI for x64, sizeof(int) is 4.

And FWIW, here is the reason of the enumeration problem:

Quoting from WG14 N1570 (Programming languages — C)
[quote]
6.7.2.2 Enumeration specifiers
4 Each enumerated type shall be compatible with char, a signed integer type, or 
an
unsigned integer type. The choice of type is implementation-defined,128) but 
shall be
capable of representing the values of all the members of the enumeration. The
enumerated type is incomplete until immediately after the } that terminates the 
list of
enumerator declarations, and complete thereafter.
[/quote]

Here if an enum has both an enumerator less than zero and another one greater 
than 0x7FFFFFFF,
neither `int` nor `unsigned` could be an option because neither is  'capable of 
representing the values of all the members of the enumeration'.
GCC is doing the correct thing to use a 64-bit integer type.


------------------                               
Best regards,
lh_mouse
2016-04-24

-------------------------------------------------------------
发件人:LRN <lrn1...@gmail.com>
发送日期:2016-04-23 03:38
收件人:mingw-w64-public@lists.sourceforge.net
抄送:
主题:Re: [Mingw-w64-public] [PATCH] Cast certain enums to int

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 22.04.2016 20:24, LRN wrote:
> This matches the behaviour of MSVC better in cases when there is a mix
> of values < 0 and values > 0x7FFFFFFF in the same enum, which, without
> this change, prompts GCC to increase enum size to 8 bytes.
> 
> Fixes bug #456
> 
> patch is attached
> 
> 

Yeah, and another thing: i don't have x86_64 gcc, nor did i test this
with x64 msvc. No idea what sizeof(any enum) on 64-bit architecture is
for these two compilers, or how that interacts with sizeof(int) being 8
there.

- -- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJXGn3RAAoJEOs4Jb6SI2CwS2AIAIuG7nleJ9X4pERg9sxlWu6q
dEWhYl+aOTRdoFnimozkwbPF6MkdJYpES68UzFeB23/pDgIz42NlTskvEOAPQRh8
EXN7TIX8mjGMY7Z/K+s4Dq/36R+6PX8Dv4r9EonlWI/gzo0/IJR2OMMaCJINC+sU
6y/NBr2ah9v+bVVQbFFUFz3MGxMrztX49BllLj+UGzQg/1Uzf1OnTs0gCk+OOUQm
Oq5u3pe1BNEVke2K9Ximya6feHZeX1S78spg/IK4VYic+7rYdOmcJplNBZ+E1N3W
3KONK3LCmEcsgeeYM2kwBVpJ5s7rTAyv+1dAIauDRx79Y+sEz4XxA1UmIShDpik=
=dZF5
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to