Widgets P252
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 29, 2015, 07:02:12 AM
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
Author Topic: P252 (Read 1004 times)
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:
 #define NSMaximumStringLength   (INT_MAX-1)

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?
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. 


Pages: [1] Go Up
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 All rights reserved.