Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > #pragma

#pragma
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2002
Status: Offline
Reply With Quote
Feb 3, 2003, 08:59 PM
 
I see it often in the Apple sample code, but there's no documentation in the Learning Cocoa Book, and I can't find any in Apple's Objective-C book. I can see that its used with something involved in method declaration. Can anyone provide me with a better description of what it does, and if I should use it?
     
Fresh-Faced Recruit
Join Date: Jul 2000
Location: Wisc. Rapids, WI, USA
Status: Offline
Reply With Quote
Feb 3, 2003, 10:50 PM
 
Originally posted by Spiffster:
I see it often in the Apple sample code, but there's no documentation in the Learning Cocoa Book, and I can't find any in Apple's Objective-C book. I can see that its used with something involved in method declaration. Can anyone provide me with a better description of what it does, and if I should use it?
pragmas? which one specificially? In general they are a way of talking to the compiler/preprocessor/whatever that is outside of the programming language that you are using. They are almost always compiler/development environment specific.

the only documentation that I've seen for Apple's stuff is here (assuming developer tools are installed):

file:///Developer/Documentation/Deve...cessor.19.html
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Feb 4, 2003, 04:16 AM
 
Are you talking about #pragma mark?

It allows you to put a label into your code that the pop-up recognises so if you can put the following:

Code:
#pragma mark - #pragma mark ??? OBEX Client Session Selectors ??? - (void)commandSentCallback:(const OBEXSessionEvent *)inSessionEvent { ...
( ??? should be three Bullets)

you get this in PB:

http://www.monkeyfood.com/thestuff/f...pragmamark.png

The one with just the dash makes a separator and the bullets (option 8) make things easier to spot
(Last edited by Diggory Laycock; Feb 4, 2003 at 04:27 AM. )
     
Fresh-Faced Recruit
Join Date: Nov 2002
Status: Offline
Reply With Quote
Feb 4, 2003, 02:49 PM
 
Thats it Diggory. I see Apple used it like this

#pragma mark PUBLIC INSTANCE METHODS
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Feb 7, 2003, 10:44 PM
 
The word is #pragma once and #import are going to be deprecated in the next version of gcc. Might think about using header guards on new source instead of relying on #import to prevent multiple inclusion.

On Thu, Feb 06, 2003 at 12:49:19PM -0800, Zack Weinberg wrote:
So we had a discussion of the problems that PCH poses for #import,
which expanded to a discussion of the problems of #import and
#pragma once generally, which then pretty much wound down without any
middle ground being found between 'there must be some way to fix it'
and 'no, sorry, there isn't'. I think that an executive decision is
required at this point, which falls to me as cpplib maintainer.

Accordingly: #import and #pragma once will be removed from FSF GCC in
3.4. I will shortly send a patch to gcc-patches to implement that.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Feb 8, 2003, 06:14 AM
 
Apple might keep #import in their gcc, which is a fork from the fsf codebase. I just fired off a mail to Stan Shebs asking him about it, I'll check back here when I get an answer
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:44 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2