• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: fshort-wchar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fshort-wchar


  • Subject: Re: fshort-wchar
  • From: Anders Markussen <email@hidden>
  • Date: Mon, 16 Apr 2012 15:37:14 +0200

On Apr 16, 2012, at 2:05 PM, Andreas Grosam wrote:
> 65535 seems odd.
>
> Could you please check if the result of the expression  *a - *b  is "unsigned int" as well when the types of the operators a and b are actually "unsigned short" ?

The result of the expression (*a-*b) is of type wchar_t in clang, and type (signed) int in gcc.
The type char_t is unsigned and 16 bits in both compilers.

> According C99 conversion rules, if a and b are "unsigned short", the expression should become effectively:
> (int)(*a) - (int)(*b)
>
> That is, the value of the expression (in your case) should equal -1.

There are rules for integral promotion in the C++ spec specifically for wchar_t.

- Anders
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >fshort-wchar (From: Anders Markussen <email@hidden>)
 >Re: fshort-wchar (From: Ron Hunsinger <email@hidden>)
 >Re: fshort-wchar (From: Anders Markussen <email@hidden>)
 >Re: fshort-wchar (From: Andreas Grosam <email@hidden>)

  • Prev by Date: Re: fshort-wchar
  • Next by Date: Um, what is the process to duplicate a class?
  • Previous by thread: Re: fshort-wchar
  • Next by thread: Xcode 4.3.2 still crashing frequently while editing text
  • Index(es):
    • Date
    • Thread