473,811 Members | 3,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with "#define" syntax ending with semicolon

5 New Member
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 3763
Banfa
9,065 Recognized Expert Moderator Expert
You knowledge is correct and this does fit

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

as follows

#define CST_CC_ERR LogMsg; s_ReportCSTFail ure // Sets __FILE__ and __LINE__


<macro name> = "CST_CC_ERR "
<Macro replacement> = "LogMsg; s_ReportCSTFail ure"

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_ReportCSTFail ure

I imagine this macro is meant to be used as

CST_CC_ERR(msg, rc, logID, out);

i.e. the parameters to s_ReportCSTFail ure 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 New Member
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
6778
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 Python 2.3.1 and GCC 3.2.3 (both installed by default with Slackware) and SWIG 1.3.19, compiled from source code. I messed around a little on my own and couldn't get things to work right, so I copied the examples from the book, nearly verbatim but...
9
2040
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 error, I don't know why this error is occuring. If i remove PORT in the statement and substitute it by 80, my code works fine. I am sure that #define works in C, any idea why my code is not
3
14465
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 UnmanagedType that hex value belongs to.
1
8212
by: James | last post by:
Hi all, How do you #define (as in C++) in C#? Many thanks, James
4
1313
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 someone show me how to do this. Below is the function and the line of the error is bold. Function GetUniversity() As String Dim Unipayment As New UnipaymentDB Dim CIDR As SqlDataReader = Unipayment.StudentState(Request.Params("StudentID"))
14
2367
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 ....... int main(void){ .....
17
2428
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: #include <stdlib.h> #include<stdio.h> #define MAX 1000000000
2
1291
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); #define SetStringAttribute(str, attr) else if(key->Equals(str)) \ ##attr## = settings->Attributes->Value; Then in my code I have the following:
5
1852
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 properties set will set every private variable.
0
9727
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10386
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10398
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6889
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.