• 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: CGFloat and 64 Bit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGFloat and 64 Bit


  • Subject: Re: CGFloat and 64 Bit
  • From: Clark Cox <email@hidden>
  • Date: Mon, 9 Feb 2009 18:48:04 -0800

On Mon, Feb 9, 2009 at 3:17 PM, Steve Sisak <email@hidden> wrote:
> At 12:52 PM -0800 2/9/09, Clark Cox wrote:
>>
>> On Mon, Feb 9, 2009 at 12:10 PM, Sean McBride <email@hidden>
>> wrote:
>>  > On 2/9/09 11:24 AM, Clark Cox said:
>>  >>That is, the preprocessor treats any undefined identifier in an '#if'
>>>>
>>>> or '#elif" as if it were defined to be zero.
>>>
>>  > I'm not a language lawyer, but I believe the latter is not guaranteed
>> to
>>>
>>>  evaluate to 0 if the macro is not defined.  However, I imagine 99% of
>>>  compilers will evaluate it to 0.  gcc certainly does.
>>
>> I am 100% positive that this is guaranteed by the standard:
>>
>>> From 6.10.1.3:
>>
>> "After all replacements due to macro expansion and the defined unary
>> operator have been performed, all remaining identifiers are replaced
>> with the pp-number 0"
>
> Just to be pedantic, which standard?
>
> You are definitely describing the behavior of the C++ preprocessor.
>
> IIRC, in ANSI C, #if of an undefined symbol is an error, and I'm not sure
> about C99.

It was the C99 standard that I was quoting above. The equivalent
passage from the C89/C90 standard:

"After all replacements are finished, the resulting preprocessing
tokens are converted into tokens, and then all remaining identifiers
are replaced with 0"

and the equivalent passage from the C++ standard:

"After all replacements due to macro expansion and thedefinedunary operator
have been performed, all remaining identifiers and keywords, except
for true and false, are
replaced with the pp-number 0"

> So, I belive #if defined(x) && (x) is good defensive programming.

Nope, it's still redundant. And I am 100% sure of that.

--
Clark S. Cox III
email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: CGFloat and 64 Bit
      • From: "Sean McBride" <email@hidden>
References: 
 >Re: CGFloat and 64 Bit (From: Rob Keniger <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Jean-Daniel Dupas <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Rob Keniger <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Jean-Daniel Dupas <email@hidden>)
 >Re: CGFloat and 64 Bit (From: "Sean McBride" <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Clark Cox <email@hidden>)
 >Re: CGFloat and 64 Bit (From: "Sean McBride" <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Clark Cox <email@hidden>)

  • Prev by Date: Re: NSScrollView: is setting the document view size supported?
  • Next by Date: Re: NSCollectionView: Different-sized items? Docs?
  • Previous by thread: Re: CGFloat and 64 Bit
  • Next by thread: Re: CGFloat and 64 Bit
  • Index(es):
    • Date
    • Thread