Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Macros in macros

Is it possible to put a macro in a macro in c++?

Something like:

#define Something\
#ifdef SomethingElse\ //do stuff \
#endif\

I tried and it didn't work so my guess is it doesn't work, unless there's some sort of syntax that can fix it?

like image 560
meds Avatar asked Apr 19 '10 01:04

meds


People also ask

How do I count macros and macros?

To find the macro ratio percentage for each, you simply divide each calorie amount by total calories (90) and then multiply by 100. Note: this percentage is different from the percent daily value on the label, which is looking at your total daily needs.

Why macros are used?

If you have tasks in Microsoft Excel that you do repeatedly, you can record a macro to automate those tasks. A macro is an action or a set of actions that you can run as many times as you want. When you create a macro, you are recording your mouse clicks and keystrokes.

Do macros matter for fat loss?

Yes, macros matter for weight loss. While the most important influence for weight loss is being in a calorie deficit, the types of foods that you eat, and your macro split, can affect factors such as how well you can stick to your diet, your blood sugar levels, and how much energy you use to metabolize your food.

What are macros in good?

The acceptable macronutrient distribution ranges (AMDR) are 45–65% of your daily calories from carbs, 20–35% from fats and 10–35% from protein. To lose weight, find a ratio you can stick with, focus on healthy foods and eat fewer calories than you burn. Interested in balanced, nutrient-rich meal plans?


2 Answers

Macros, yes. Preprocessor directives, which are what you posted, no

like image 179
Michael Mrozek Avatar answered Oct 07 '22 15:10

Michael Mrozek


No, but you can simply refactor this by pulling the #ifdef out as the toplevel, and using two different #define Something ... versions for the true and false branches of the #ifdef.

like image 37
Alex Martelli Avatar answered Oct 07 '22 17:10

Alex Martelli