Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:45:55+00:00 2026-06-03T14:45:55+00:00

Is it possible to have a custom availability macro like the __OSX_AVAILABLE_STARTING for instance.

  • 0

Is it possible to have a custom availability macro like the __OSX_AVAILABLE_STARTING for instance. I need it to perform in the same way, I just need to change its name and the versions and number of parameters?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:45:58+00:00Added an answer on June 3, 2026 at 2:45 pm

    Yes, certainly. Objective-C is a strict superset of C, so C macros are very much at your disposal, and that facility is simply a set of C macros that eventually expand to
    gcc’s __attribute__ keyword to declare special attributes of a function.

    The relevant declarations are all in

    • Availability.h
    • AvailabilityInternal.h

    To refresh, you use the __OSX_AVAILABLE_STARTING macro to tag a function declaration as being supported for a particular version, like this:

    extern void mymacfunc() __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
    

    So what do we need to implement this ourselves? If you strip their
    support for two different OS (mac, iphone), the availability facility boils down to:

    1. A macro that takes a version argument like __MY_AVAILABLE_STARTING(<version>):

      #define __MY_AVAILABLE_STARTING(_myversion) __MY_AVAILABILITY_INTERNAL##_myversion
      
    2. Set of version arguments, like those in Availability.h, that are valid arguments for the above:

      #define __MYVER_2_0     20000  
      #define __MYVER_2_1     20100  
      #define __MYVER_2_2     20200  
      #define __MYVER_3_0     30000  
      
    3. Another set of macros, like thos in AvailabilityInternal.h that specifies what should happen for each version (regular support, deprecated, unavailable, weak, etc). Again, this is a function of the compiler, see gcc docs (there are lots of other interesting options):

      #define __MY_AVAILABILITY_INTERNAL__MYVER_2_0 __AVAILABILITY_INTERNAL_UNAVAILABLE
      #define __MY_AVAILABILITY_INTERNAL__MYVER_2_1 __AVAILABILITY_INTERNAL_WEAK_IMPORT
      #define __MY_AVAILABILITY_INTERNAL__MYVER_2_1 __AVAILABILITY_INTERNAL_REGULAR
      
    4. And finally, where the buck ends, the macros that expand to the __attribute__ facility.

      For the ones I have above, you can just keep using Apple’s macros:

      #define __AVAILABILITY_INTERNAL_DEPRECATED         __attribute__((deprecated,visibility("default")))
      #define __AVAILABILITY_INTERNAL_UNAVAILABLE        __attribute__((unavailable,visibility("default")))
      #define __AVAILABILITY_INTERNAL_WEAK_IMPORT        __attribute__((weak_import,visibility("default")))
      #define __AVAILABILITY_INTERNAL_REGULAR            __attribute__((visibility("default")))
      

      Or, of course, you can define your own craziness.

    C Macros are powerful stuff, often overlooked. Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if its possible to have an ASP.NET AJAX custom usercontrol 'register'
Is it possible to have a custom icon displayed for a QAction when it
Is it possible to have scoped macros using custom defined macros through boost wave?
Is it possible to have nested set capabilities in this somewhat custom setup? Consider
I have noticed that it is possible to define a custom class and then
Is it possible have two projects with the same name in flex builder? Here
Is it possible to have multiple classes that inherit/extends same class in Google AppEngine
Is it possible to have custom headers on Amazon S3 with arbitrary naming? For
I do not plan on using Weld, but still would like to have custom
Is it possible to have a mix of RIA WCF services and custom WCF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.