Click here to Skip to main content
15,885,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I make define header file.

The format make error..
C++
#define LOG_FORMAT(id, level, logformat, ...) \
{\
    if (zsummer::log4z::ILog4zManager::GetInstance()->PrePushLog(id,level)) \
    {\
       if(zsummer::log4z::ILog4zManager::GetInstance()->GetChangeFileStatus()==1)\
       {\
         zsummer::log4z::ILog4zManager::GetInstance()->PushLog(id, level, "Title");\

        }\

        char logbuf[LOG4Z_LOG_BUF_SIZE];\
        int ret = _snprintf_s(logbuf, LOG4Z_LOG_BUF_SIZE, _TRUNCATE, logformat, ##__VA_ARGS__);\
        zsummer::log4z::ILog4zManager::GetInstance()->PushLog(id, level, logbuf);\

    }\
 }
Posted
Updated 1-Jun-15 17:41pm
v2
Comments
Gihan Liyanage 1-Sep-14 1:38am    
I do not familiar with this type of code. But I just think if you could have provided the error, then people may understand the problem clearly and you will be get the answer quickly.
[no name] 1-Sep-14 3:00am    
1. You have not told us where or what the error is (please don't).
2. Your approach is wrong. What is need for macro? Why not use a static function and allow the compiler to do it's work.
http://stackoverflow.com/questions/14041453/why-are-preprocessor-macros-evil-and-what-are-the-alternatives
Richard MacCutchan 1-Sep-14 3:25am    
That is really bad practice, use a proper function and make calls in the code.
Mohibur Rashid 1-Sep-14 3:42am    
what is the definition of PushLog function
?
Sun-Mi Kang 1-Sep-14 4:28am    
sorry bad question..
I remove this code.

And make function..

1 solution

Note that you are not allowed to have empty lines in your macro. They also need to be terminated with a backslash. Otherwise they terminate the macro.

If this is not the obvious error, please let us know the exact error messages you get.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900