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

  • Home
  • SEARCH
  • 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 480379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:53:12+00:00 2026-05-13T00:53:12+00:00

I try to make a useful macro for logging. But I find that NSLog

  • 0

I try to make a useful macro for logging. But I find that NSLog and all other sort of macros that carry textual information with them simply distract a lot from the code.

Is there any way to “hack” Xcode in a way that it will interpret something like

/*** do this because of that ***/ 

as a macro call, which results in calling NSLog, for example? I want those logs to “feel” like comments. Anything else that looks like critical code is just distracting and reduces productivity at the end, and then there’s no real benefit from logging what’s going on.

  • 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-13T00:53:13+00:00Added an answer on May 13, 2026 at 12:53 am

    Is it possible to define a macro that looks almost like a comment?

    Why do you want to make your code less readable?

    The answer is no, and that’s a good thing.

    Is there any way to “hack” Xcode in a way that it will interpret something like

    /*** do this because of that ***/
    

    as a macro call…

    Probably, but that’s useless. All that would do is make the syntax coloring incorrect (coloring this comment as if it were a function call). The compiler (either GCC or Clang) would still see this as the comment that it is.

    Making the compiler think it’s a function call or macro invocation is what would actually achieve log output at run time, but even if you could do that, it’s still a bad idea because you would have a function call or macro invocation disguised as a comment.

    If you want your program to log messages, write logging code:

    NSLog(@"Do %@ because of %@.", foo, bar);
    

    This code is explicitly code that does something at runtime. No mystery. No surprises. That’s why it’s better.

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

Sidebar

Related Questions

can i somehow find all functions/macros that take a specific type of parameter ?
I try to make an imageview clickable. Actually it is clickable, so that I
I try to make a apps that need barcode scanner, i already can get
I try to make an animation with an image in my view but it
[Editor's note: I have edited the title to try to make this useful to
I have a simple Class that I thought I could make more useful if
My issue is to make ant logging in the way I need. So that
I try to make my ListBox connected to ObservaleCollection be more efficient so for
I try to make an ActiveX by C# with COM-visible. It is a Windows
I try to make a table header fixed when scoll down on pages. The

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.