473,382 Members | 1,441 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,382 software developers and data experts.

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 1450
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*********@gmail.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
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? ...
12
by: Sweety | last post by:
plz reply, thanks in advance. bye,
0
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...
27
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
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...
5
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...
6
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) ?...
8
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
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,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?

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.