Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
December 10, 2018, 03:20:51 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
Author Topic: P252  (Read 1647 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:  

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 ゥ 2009 All rights reserved.