473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need help with "#define" syntax ending with semicolon

5
Can someone explain me what's going on in the code below. As per my knowledge "#define <macro name> <Macro replacement>" doesn't have a semicolon and it's terminated by a new line. But the code line in bold below has a semicolon and is followed by a function declaration. (This is a piece of working, complied code)

Expand|Select|Wrap|Line Numbers
  1.   #define CST_CC_ERR LogMsg; s_ReportCSTFailure // Sets __FILE__ and __LINE__
  2.  
  3.   static void s_ReportCSTFailure( const string& msg, int rc, CST_LOG_ID logID,  ccAuthViewR* out )
  4.  {
  5. ....
  6.  
  7. }
  8.  
Nov 20 '06 #1
2 3739
Banfa
9,065 Expert Mod 8TB
You knowledge is correct and this does fit

"#define <macro name> <Macro replacement>"

as follows

#define CST_CC_ERR LogMsg; s_ReportCSTFailure // Sets __FILE__ and __LINE__


<macro name> = "CST_CC_ERR"
<Macro replacement> = "LogMsg; s_ReportCSTFailure"

i.e. everything following the macro name up to the new line excluding comments

When used the replace ment is then the statement

LogMsg;

I do not know what that is meant to do followed by the function name

s_ReportCSTFailure

I imagine this macro is meant to be used as

CST_CC_ERR(msg, rc, logID, out);

i.e. the parameters to s_ReportCSTFailure follow the macro, the macro is used instead of calling the function directly so that the extra expression LogMsg; is also executed.
Nov 20 '06 #2
slrj
5
Banfa,

Thanks for your explanation. It make sense now.

Thanks.
Nov 20 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Chris Hodapp | last post by:
I have seen messages posted about this before, and there is a clear reference to it in the manual, but I have been unable to find a solution. I'm on Slackware 9.1, kernel 2.6.0-test11, using...
9
by: Harshit | last post by:
I am working on socket programming, encountered a new and strange problem today. I am using #define PORT 80, before main(), and I am calling PORT in one of the statments inside main(), I get an...
3
by: xudeutsch | last post by:
I have such a block in C++ #pragma pack(push,4) #define STATE_NULL 0x0000 #pragma pack(pop) and I need to convert it to C#. I want to use the "MarshalAs" attribute, but i dont know which...
1
by: James | last post by:
Hi all, How do you #define (as in C++) in C#? Many thanks, James
4
by: paapa21 | last post by:
I want to Declear a variable as SqlDataReader in ASP 2.0. But when i do so it tells me SqlDataReader is not define. This same code works in my previous application in ASP 1.0. Has this change? Can...
14
by: Chen Shusheng | last post by:
CSS white here: Simply strange, I found "define" can not work with "malloc". Together my complier will say "parse error". Could anyone tell me why? ------------------------- #define MAX 10000...
17
by: Chen Shusheng | last post by:
Hi all, In fact, I want to let my memory run out. And see what will happen. My system is windowsXp. Memory is 256M.I think my cdes will apply more memory than I have. Codes are below: ...
2
by: ewpatton | last post by:
I have two preprocessing macros defined in my program: #define SetBooleanAttribute(str, attr) else if(key->Equals(str)) \ ##attr## = (settings->Attributes->Value=="true" ? true : false);...
5
by: PLS | last post by:
I have a struct containing a few private members and a bunch of properties. When I try to use the structure like this ABC item; item.property1 = 1; item.property2 = 2; ... In total, the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.