#undefine

Has like this undef define in c++?Such as:
 
#define inti int 

1
2
#undefine inti2 inti
cout<<typeid(inti2).name();

I don't know what you're trying to accomplish with that second set of code.. but you can undefine macros with the #undef command:

1
2
3
4
5
6
7
#define foo int

foo bar;  // same as int bar;

#undef foo  // foo no longer is defined

foo baz;  // compiler error, foo is not defined. 
I base to find invers define.I know #undef
I don't understand what you mean. Can you clarify?
Yeah. What do you mean by "inverse" define?
Ok.
1
2
#define foo int
cout<<#undefined foo//#undefined or another transaction 

Output:
 
int
Like this?
1
2
3
#define foo int
#define quote(x) #x
cout << quote(foo);
Last edited on
No.What is the aggregation transaction's reverse?
Answer:Abstraction transaction.
I am finding define transaction reverse.I want to reverse define transaction.
It's very difficult to understand what you mean.

If you're not asking about #undef, then I don't know what you need.

Can you can give more examples of what you need?
I can't help but to think you are confused.
Zhuge's exam output:foo.I want to find startest variable (int).ok?
1
2
3
4
5
#define foo int
#(my transaction) abc foo
cout<<abc;
Output:
int
As for getting a string literal...for the preprocessor to expand the macro, it needs to not be inside of another macro (like quote()). But without the quote macro, you won't get a string literal and won't be able to cout it. You could do something semi-hackish like so, though:

1
2
3
4
#define foo int
#define abc foo
abc x; // x will be an int
std::cout<<typeid(x).name()<<std::endl;


This uses typeid(), though, which is non-standard (I think).
Yes.U apprehended me.
bully for you :)
U brainy person u:)
Topic archived. No new replies allowed.