• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
__attribute__ in Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

__attribute__ in Objective-C


  • Subject: __attribute__ in Objective-C
  • From: "Alexander v. Below" <email@hidden>
  • Date: Fri, 21 Oct 2005 13:45:02 +0200

Hello,

I hope this post is considered on topic, but I guess this list knows more about this than any gcc list...

How do I use the gcc "__attribute__" (1)correctly in a Objective-C declaration?

Both:

- (IBAction) test:(id)sender __attribute__ ((unused))
- (IBAction) test:(id) __attribute__ ((unused)) sender

are not parsed successfully. The following is parsed

- (IBAction) test:(id __attribute__ ((unused)))sender

however, gcc still generates a warning "unused parameter: sender"

While Apple gcc provides the old CodeWarrior #pragma unused, I found that it does not work well with C++ code. Consequently, I wanted to "migrate" to __attribute__ unused in all subseqent code.
Also, the gcc documentation(2) makes the claim that " It was basically a mistake to use #pragma for anything."


Any pointers are appreciated.

Thanks

Alex

(1) http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.0/ gcc/Attribute-Syntax.html#Attribute-Syntax
(2) http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.0/ gcc/Variable-Attributes.html


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: __attribute__ in Objective-C
      • From: "Timothy J. Wood" <email@hidden>
  • Prev by Date: Re: Multi-threaded opengl or view access crashes system?
  • Next by Date: Re: NSWindow and NSImageView
  • Previous by thread: Re: OT: Cocoa or Carbon?
  • Next by thread: Re: __attribute__ in Objective-C
  • Index(es):
    • Date
    • Thread