Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm a newb to cocoa programming and looking around in various open source code online I see things like:

#pragma mark global variable declaration

and I was wondering what the meaning of "pragma mark" is in that is it any different than a // or /* (comment) block..like is it used throughout the program, and is there a commonly used methodology to it, or is it more or less a way for programmers to organize and collect their code for themselves (and others if the case may be) to use later?

I found this article: http://inchoo.net/mobile-development/iphone-development/what-is-a-pragma-mark/

and it is pretty helpful, but I just needed to clarify again if it's more or less used by the coder or used by XCode?

Thanks!

share|improve this question
    
Isn't this a question for Stack Overflow? –  kiamlaluno May 15 '11 at 23:25
    
I wasn't sure. At first I thought so, but then I was considering that it may be something that's more of a "developer preference" type thing. –  Zac Brown May 15 '11 at 23:28
    
This is fine here. –  user8 May 15 '11 at 23:33
add comment

1 Answer

up vote 7 down vote accepted

pragma mark is used by xcode to organize your code by creating as drop down list of methods contained within the scope of the pragma mark.

share|improve this answer
    
excellent clarification! that's a very helpful feature. are there any "standard" methods of using it or is it just up to the developer? –  Zac Brown May 15 '11 at 23:26
    
@Zac Not a lot of standard methods, but in Xcode 4 if you use #pragma mark - My Cool Section, the hyphen right there will make Xcode display a horizontal line in the menu, under which will be (in this example) My Cool Section. –  Matthew Frederick May 15 '11 at 23:50
    
wow, that's pretty cool. I'll play around with it and I bet it's really helpful. after I've achieved more rep I'll come back and vote this answer up :-) –  Zac Brown May 15 '11 at 23:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.