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 7585869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:16:53+00:00 2026-05-30T19:16:53+00:00

So, I use NSArrays a lot, so I decided to attempt to create a

  • 0

So, I use NSArrays a lot, so I decided to attempt to create a macro that will create an array from primitives passed in, based on the macros here:

https://bitbucket.org/snej/myutilities/src/319441e240fa/CollectionUtils.h

#define $array(values...) ({ void *v[] = { values }; const char *encodings[] = { /* how do I get the @encode-ings for each? */ };  _boxArray(v, encodings, sizeof(values) / sizeof(void *))})

NSValue *_box(void *value, const char *encoding); // defined by CollectionUtils

NSArray *_boxArray(void **values, const char **encodings, int count)
{
    id objects[count];

    for (int i = 0; i < count; i++) {
        // how can I box all of the values that need boxing?
        objects[i] = _box(values[i], encodings[i]);
    }

    return [NSArray arrayWithObjects:objects count:count];
}

So basically, what I am asking, is how can I, with variadic macro, perform an operation on each of the arguments passed to the macro?

  • 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-05-30T19:16:54+00:00Added an answer on May 30, 2026 at 7:16 pm

    This is not a direct answer for your question, but…
    Maybe you should just wait for LLVM 4.0, which includes autoboxing feature for primitives?

    Have a look: http://blog.ablepear.com/2012/02/something-wonderful-new-objective-c.html

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

Sidebar

Related Questions

use this website a lot but first time posting. My program creates a number
Use Case When a user goes to my website, they will be confronted with
I have an NSMutableArray that contains many NSArrays. At a specific (static) index in
I'm working on an app for personal use that displays lists of associated words
I feel that when I use NSArray, I might constraint myself some time in
is there anyway i can use search bar on the nsmutable array . i
I want to build an array of strings, that can point every time to
I'm trying to use NSArray's filteredArrayUsingPredicate: method to filter an array of core data
I use this a lot NSSortDescriptor *descriptor = [NSSortDescriptor sortDescriptorWithKey:nil ascending:YES comparator:^(id obj1, id
I'm refactoring a project that involves passing around a lot of arrays. Currently, each

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.