0

What is macros and what are its role in computer??

23rd Dec 2017, 11:13 AM
shivam kumar
7 Respuestas
+ 1
Macros is a set of user actions repeated by some tool. For example in MS Excel you can record user manipulations, and play them when you need like fill specific cells, or adding columns and rows. In linux such things done with bash scripts, you can automate some repetitive actions.
23rd Dec 2017, 11:27 AM
Dima Makieiev
Dima Makieiev - avatar
+ 5
Macros are automated functions that runs for a set of data
23rd Dec 2017, 11:26 AM
Aymen ELARBI
+ 2
In C++ macros are alias to prevent from copying the code too many time. The preprocessor will replace the call of the macro by what it represent
23rd Dec 2017, 12:04 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
- 1
One application: #define your_macro #ifdef your_macro //true, we just defined it //write your code here which is just evaluated if your_macro is defined #endif Other application: #define your_macro some code snippet Whenever you write your_macro, it is replaced with some code snippet. #ifdef works also, of course. Note: Macros work across files.
23rd Dec 2017, 1:23 PM
Timon Paßlick
- 1
@Martin Taylor This isn't a guard at all, it's just a sample. Noone uses #ifndef guards now anyways but #pragma once.
23rd Dec 2017, 1:38 PM
Timon Paßlick
- 1
Yes, but this question is tagged c++.
23rd Dec 2017, 1:39 PM
Timon Paßlick
- 1
Where isn't it supported?
23rd Dec 2017, 3:02 PM
Timon Paßlick