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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:49:18+00:00 2026-06-12T03:49:18+00:00

Please pardon me if I am asking an obvious question, but after going through

  • 0

Please pardon me if I am asking an obvious question,
but after going through a bunch of threads and trying out stuff, I am not able to pin down this simple thing.

I have this small program:

#define FUNC_PREFIX __FUNCTION__ "() :"

int main()
{
    printf("%s\n", FUNC_PREFIX);
    return 0;
}

So I can pass FUNC_PREFIX instead of __FUNCTION__ to log functions and they will print the calling function name followed by paren and colon — just so to improve readability of log line outputs.

This compiles fine as-is in Visual Studio 2008.
But in g++, I get an error expected ‘)’ before string constant

I tried a few things like doing:

#define TEMP __FUNCTION__ 
#define FUNC_PREFIX TEMP "() :" 

but to no avail.

What is the way to go about doing this?

  • 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-12T03:49:20+00:00Added an answer on June 12, 2026 at 3:49 am

    Your printf is missing a quote. Use identifier __func__ and you can print two strings if you define the macro as:

    #define FUNC_PREFIX __func__,"() :"
    
    int main()
    {
        printf("%s %s\n", FUNC_PREFIX);
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please Pardon if the question sounds silly, but nevertheless its a question which I
Please pardon the newbie question, but I'm stumped. I'm a teacher converting a Rails
please pardon the absolutely newbie question but i'm very new to tableau. what I'd
I am just starting out with javascript so please pardon me if my question
Perhaps this is a very basic question, please pardon me if it is ---
Please pardon me if this has been asked before, but I'm wondering if there
First, please pardon my rusty Perl. I'm trying to modify Bugzilla's "whine.pl" to generate
Please pardon me if my question sounds very basic. I am working on a
Please pardon me for a n00bish question. Please consider the following code: public class
I am new to Jquery so please pardon me if I am asking a

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.