Amazon.com Widgets P252
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 30, 2014, 04:55:56 PM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Chapter Study
| | |-+ Chapter 12 - The Preprocessor
| | | |-+ P252
Pages: [1] Go Down
Print
Author Topic: P252 (Read 768 times)
bamboo
Newbie
*
Posts: 14






on: April 17, 2011, 11:29:21 AM

"As an example of how this can be used, the following lines appear in the Foundation header file NSString.h:
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
 #define NSMaximumStringLength   (INT_MAX-1)
#endif

This tests the value of the defined variable MAC_OS_X_VERSION_MIN_REQUIRED against the defined variable MAC_OS_X_VERSION_10_5. If the former is less than the latter, the #define that follows is processed; otherwise, it is skipped. "

I am reading Chapter 12 The Preprocessor today, and this sentence confuses me.
from the name  MAC_OS_X_VERSION_MIN_REQUIRED, it seems like it is defined name using the #define statement, but since a defined name is not a variable, as it's mentioned previously.

can someone tell me what kind data type it is?
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #1 on: September 09, 2011, 03:03:20 PM

They are defined names and their values get substituted and then compared by the #if, which can evaluate numeric expressions.  So there's a double processing (in a sense) of that line that's done by the preprocessor:  first substitute the text defined for the two name, then evaluate the expression. 

Cheers,

Steve
 
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.