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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:48:17+00:00 2026-05-25T19:48:17+00:00

I am define TOOLS_COMPUTE_TIME like this #define TOOLS_COMPUTE_TIME(op) [Tools computeTimeWithName:__PRETTY_FUNCTION__ block:(op)] +(void)computeTimeWithName:(NSString *) caller

  • 0

I am define TOOLS_COMPUTE_TIME like this

#define TOOLS_COMPUTE_TIME(op) [Tools computeTimeWithName:__PRETTY_FUNCTION__ block:(op)]

+(void)computeTimeWithName:(NSString *) caller block:(void (^)())block
{
    NSDate * currentTime = [NSDate date];
    block();
    DLog(@"Time Running is: %f", [[NSDate date] timeIntervalSinceDate:currentTime]);
    DLog(@"Caller : %@", caller);
}

and then when I call:

TOOLS_COMPUTE_TIME(^{

});

[Tools computeTimeWithName:ThisFunction block:^{
    //I want to move this blog on top
    NSString * urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%f,%f&output=csv",[BNUtilitiesQuick UtilitiesQuick].currentAnchor.coordinate.latitude,[BNUtilitiesQuick UtilitiesQuick].currentAnchor.coordinate.longitude];
    NSURL * Url= [NSURL URLWithString:urlString];
    NSString * result = [NSString stringWithContentsOfURL:Url encoding:NSASCIIStringEncoding error:nil];
    NSArray *lines = [result componentsSeparatedByString:@","];
    locationString =[NSString stringWithFormat:@"%@\"",[lines objectAtIndex:2]];
}];

it’s still have many error.. like “Macro “TOOLS_COMPUTE_TIME” passed 4 arguments, but takes just 1″

something like that code have many argument, but I think that code pass just one argument like block

anyone can help me to fix it?

Another error seems to be on the type of PRETTY_FUNCTION It’s not NSString * isn’t it. What?

  • 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-25T19:48:17+00:00Added an answer on May 25, 2026 at 7:48 pm

    The problem is the C Preprocessor isn’t savvy with obj-c syntax. You can get around this by telling it your macro takes varargs

    #define TOOLS_COMPUTE_TIME(...) [Tools computeTimeWithName:__PRETTY_FUNCTION__ block:(__VA_ARGS__)]
    

    This way it’ll take anything at all between the parens and pass it on. This will only fail if you have an unbalanced end parenthesis, which should fail anyway but you’ll probably get a curious compiler error this way.

    As for the string error, PRETTY_FUNCTION is a C String (e.g. char*), not an NSString. Either rewrite your +[Tools computeTimeWithName:block:] function to take a char* as it’s first argument, or pass [NSString stringWithUTF8String:__PRETTY_FUNCTION__] instead (the former is easier, just change the format token for your log to %s instead of %@).

    As a side note, NSDate isn’t ideal for computing runtimes, since it’s based on the clock time which is subject to drift (intentional or otherwise) and which could change on you. You should base yourself on mach absolute time instead. Luckily for you, CoreAnimation has a convenience function CACurrentMediaTime which returns mach absolute time expressed as a CFTimeInterval (e.g., in seconds). You can use this instead to figure out a reliable runtime for a block.

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

Sidebar

Related Questions

I just define a root path as a constant like this define(ROOT_PATH, dirname(__FILE__)); so,
I define a 'block' of text as all lines between start of file, newline
I would like to put JDK tools.jar as compile dependency. I found some examples
Inside an xs:complexType, there are elements: Running .NET tools like SvcUtil.exe, you will get
There are statements like SET server output ON PRINT var_name DEFINE var_name VARIABLE var_name
This is less of a programming question and more of a suggestions for tools
Chrome Developer Tools define a convenient $ function (as well as a few other
Does an auto-formatting tool exist for vi that'll allow me to define per language
(define a 42) (set! 'a 10) (define a 42) (define (symbol) 'a) (set! (symbol)
(define (lcs lst1 lst2) (define (except-last-pair list) (if (pair? (cdr list)) (cons (car list)

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.