• 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: Type of @true in Obj-C vs Obj-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Type of @true in Obj-C vs Obj-C++


  • Subject: Re: Type of @true in Obj-C vs Obj-C++
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 09 Jul 2013 11:56:40 -0700


On Jul 9, 2013, at 11:31 AM, Scott Ribe <email@hidden> wrote:

I don't see what @true/@false have to do with true/false.

@true is a shortcut for @(true), so the compiler first evaluates ‘true’ and then boxes the result.

I think the issue is that the auto-boxing code has a special case for the Obj-C YES/NO constants that outputs boolean-type NSNumbers instead of 0/1, but it doesn’t have the same special case for the C99 ‘bool’ type.


On Jul 9, 2013, at 02:48 , Jean-Daniel Dupas <email@hidden> wrote:

No, unless you redefine the true and false macros.
The C standard specifies that true and false are macro that expand to integer constant with value 1 and 0 respectively.

In C99 ‘true’ and ‘false’ are builtin constants of type ‘bool’, not macros. (Right? IANALL.)

—Jens
 _______________________________________________
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

  • Follow-Ups:
    • Re: Type of @true in Obj-C vs Obj-C++
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: Type of @true in Obj-C vs Obj-C++
      • From: Scott Ribe <email@hidden>
References: 
 >Type of @true in Obj-C vs Obj-C++ (From: Rick Mann <email@hidden>)
 >Re: Type of @true in Obj-C vs Obj-C++ (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Type of @true in Obj-C vs Obj-C++ (From: Rick Mann <email@hidden>)
 >Re: Type of @true in Obj-C vs Obj-C++ (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: TDD : Prior test failures in Issues Navigator are annoying
  • Next by Date: Re: Type of @true in Obj-C vs Obj-C++
  • Previous by thread: Re: Type of @true in Obj-C vs Obj-C++
  • Next by thread: Re: Type of @true in Obj-C vs Obj-C++
  • Index(es):
    • Date
    • Thread