473,770 Members | 4,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is it possible to write a macro to achieve this?

i want to define a macro like

#define STRING2(x) #x
#define STRING(x) STRING2(x)

#define PROMPT(x) #pragma message(__FILE_ _ "(" STRING(__LINE__ ) "):"
STRING(x)) <---- compile failed

i want to use this macro to remind me that something need to be done
but not done yet. is it possible to write such a macro??
Jun 27 '08 #1
3 1475
thinktwice wrote:
i want to define a macro like

#define STRING2(x) #x
#define STRING(x) STRING2(x)

#define PROMPT(x) #pragma message(__FILE_ _ "(" STRING(__LINE__ ) "):"
STRING(x)) <---- compile failed

i want to use this macro to remind me that something need to be done
but not done yet. is it possible to write such a macro??
No. You cannot define a macro that would expand into another preprocessor
directive.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #2
thinktwice <me*********@gm ail.comwrote:
i want to use this macro to remind me that something need to be done
but not done yet.
Why not just use #warning?

Given your compiler supports this directive of course.

cu
Jun 27 '08 #3
Hi,

why not just using "TODO" in comments for the related locations?
You then can just grep for "TODO" for you consilidation / clean-up
phase in coding.
Also IDE like eclipse will highlight "TODOs" in their viewer with
notepad icon or alike.

rgds
Frank
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1907
by: Glenn | last post by:
We want to deploy a change to a database with minimal effort by the users. I see how to open an Access database from the command line, but can you then issue DDL statements through a command line? Can't find much in the help. Using Access 2002. Want an "installshield" type of approach, but I'm not too familiar with Access' capabilities. Any suggestions for a simple way to achieve the result would be appreciated.
12
4083
by: Sweety | last post by:
plz reply, thanks in advance. bye,
0
1172
by: | last post by:
Hi, I want to find out how much time is spent in macro-code, without having to change all macro-definitions to include some tracking code. Thus when compiling a file, the preprocessor would (during macro-expansion), add some extra code, to make it easier to see at runtime (using some profiling tool) how often certain macro's were used. For example this macro: #define P(a,b,c) \ a=1;\
27
31956
by: Yan | last post by:
A lot of times when reading open software, i come across macros that are defined as follows: #define CALL_FUNCS(x) \ do { \ func1(x); \ func2(x); \ func3(x); \ } while (0);
7
23551
by: fei.liu | last post by:
#define ONCFILE_ERR1(funcname, name) \ { \ #ifdef DEBUG\ cerr << __FILE__ << ":" << __LINE__ << " duplicated call to " << funcname << " " << name << endl; \ #endif \ } I want to have conditional macros inside a macro. When I compile this
5
3567
by: krbyxtrm | last post by:
Hi is there a way to 'manage' function execution using macros? #define MY_CALL_MACRO(MacroName) { g_MacroStack.push_back(MacroName); <some code here...>} such that when i use the macro like this: MY_CALL_MACRO("MyMacroName")
6
2613
by: pedroalves | last post by:
Hi all, This is not a question about how to #define COMMA , Please keep reading. Recently in binutils, we introduced a macro like this: #define STRING_COMMA_LEN(STR) \ (STR), ((STR) ? sizeof (STR) - 1 : 0)
8
366
by: Peithon | last post by:
Hi, I'm initialising unit test structures using a macro as follows: #define UTMACRO(x) UT##x typedef struct { char * key; char * arr;
7
10987
by: seagullino | last post by:
Hello, Is it possible to write/record a macro in Access that would create a new table? The new table's name would be assigned based on the current value in one of the combo boxes in the form, and the new table would only need to be one column. Thanks!
0
9602
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
10237
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10017
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
9882
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...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7431
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...
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
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.