Skip to main content
added 12 characters in body
Source Link
463035818_is_not_an_ai
  • 128.6k
  • 11
  • 116
  • 240

I want to change the priority of the preprocessor define process.

see the following code:

#include <iostream> #include <sstream> #define $(x) << x << #define f(x) (#x) int main() { auto world = "universe!"; std::stringstream ss; ss << f(Hello $(world)) << std::endl; std::cout << ss.str(); return 0; } 

The code run, but the 'f' macro will always processed before the '$' macro.

The current output: Hello $(world)

The current output:

Expected output: Hello universe!

Hello $(world) 

Expected output:

Hello universe! 

Thx.

I want to change the priority of the preprocessor define process.

see the following code:

#include <iostream> #include <sstream> #define $(x) << x << #define f(x) (#x) int main() { auto world = "universe!"; std::stringstream ss; ss << f(Hello $(world)) << std::endl; std::cout << ss.str(); return 0; } 

The code run, but the 'f' macro will always processed before the '$' macro.

The current output: Hello $(world)

Expected output: Hello universe!

Thx.

I want to change the priority of the preprocessor define process.

see the following code:

#include <iostream> #include <sstream> #define $(x) << x << #define f(x) (#x) int main() { auto world = "universe!"; std::stringstream ss; ss << f(Hello $(world)) << std::endl; std::cout << ss.str(); return 0; } 

The code run, but the 'f' macro will always processed before the '$' macro.

The current output:

Hello $(world) 

Expected output:

Hello universe! 

Thx.

added 57 characters in body
Source Link

I want to change the priority of the preprocessor define process.

see the following code:

#include <iostream> #include <sstream> #define $(x) << x << #define f(x) (#x) int main() { auto world = "universe!"; std::stringstream ss; ss << f(Hello $(world)) << std::endl; std::cout << ss.str(); // Out: Hello $(world) return 0; } 

The code run, but the 'f' macro will always processed before the '$' macro. Thx

The current output: Hello $(world)

Expected output: Hello universe!

Thx.

I want to change the priority of the preprocessor define process.

see the following code:

#include <iostream> #include <sstream> #define $(x) << x << #define f(x) (#x) int main() { auto world = "universe!"; std::stringstream ss; ss << f(Hello $(world)) << std::endl; std::cout << ss.str(); // Out: Hello $(world) return 0; } 

The code run, but the 'f' macro will always processed before the '$' macro. Thx.

I want to change the priority of the preprocessor define process.

see the following code:

#include <iostream> #include <sstream> #define $(x) << x << #define f(x) (#x) int main() { auto world = "universe!"; std::stringstream ss; ss << f(Hello $(world)) << std::endl; std::cout << ss.str(); return 0; } 

The code run, but the 'f' macro will always processed before the '$' macro.

The current output: Hello $(world)

Expected output: Hello universe!

Thx.

edited tags
Link
463035818_is_not_an_ai
  • 128.6k
  • 11
  • 116
  • 240
Source Link
Loading