can somebody explain me what is macro in programming
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
can somebody explain me what is macro in programming
can somebody explain me what is macro in programming
with pratical examples and layman words
i think and i beleive that they are like the _time_ and the values that are self defined and also the things that are already defined in the libc and ready to be used in programming and without self defining them
am i right?
Last edited by shlomo.hovir; 10-17-2018 at 06:39 PM.
can somebody explain me what is macro in programming
with pratical examples and layman words
i think and i beleive that they are like the _time_ and the values that are self defined and also the things that are already defined in the libc and ready to be used in programming and without self defining them
am i right?
Last edited by shlomo.hovir; 10-17-2018 at 06:31 PM.
A quick search will turn up many useful links, including this Wikipedia article which looks very helpful.
A macro is essentially a short expression or marker which represents a larger block of code. When the macro is found by the language processor it is expanded into its full representation. This makes repetitive use of some code patterns less tedious and error prone, as noted in the above article.
Do you have a specific question about macro use? If so, it would be best to give a simple example of what you have in mind so that others here may provide a specific answer.
Please review the Site FAQ for guidance in asking well formed questions.
A quick search will turn up many useful links, including this Wikipedia article which looks very helpful.
A macro is essentially a short expression or marker which represents a larger block of code. When the macro is found by the language processor it is expanded into its full representation. This makes repetitive use of some code patterns less tedious and error prone, as noted in the above article.
Do you have a specific question about macro use? If so, it would be best to give a simple example of what you have in mind so that others here may provide a specific answer.
Please review the Site FAQ for guidance in asking well formed questions.
a macro are self defined things like values contained in libc or header files like _time_ or values of super globals don't know exactly whats their names like $_GET's values in php
Last edited by shlomo.hovir; 10-17-2018 at 07:22 PM.
a macro are self defined things like values contained in libc or header files like _time_ or values of super globals don't know exactly whats their names like $_GET's values in php
No.
Some of those things may be macros, but that is not what macros "are". PHP's $_GET is not a macro.
Please read the linked article and perform your own search to try to find one that you can best understand easily. And read to understand, not so much for quick but incomplete answers.
Some of those things may be macros, but that is not what macros "are". PHP's $_GET is not a macro.
Please read the linked article and perform your own search to try to find one that you can best understand easily. And read to understand, not so much for quick but incomplete answers.
Originally, term 'macro-instruction' meant 'user-defined instruction' in Assembly, e.g.:
Code:
MACRO ; define a macro
MY_LD_DE_HL ; name of the macro
LD E,(HL)
INC HL
LD D,(HL)
DEC HL
MEND ; end of definition
...
LD HL,(someptr)
MY_LD_DE_HL ; use the macro
Last edited by NevemTeve; 10-18-2018 at 02:04 AM.
Reason: comments
Please post your thread only once. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. Your new thread has been merged with this previous thread of the same general topic.
I will also ask you again to refrain from posting links to offsite resorces as the primary content of your posts. This behavior is not an acceptable use of the LQ Programming forum.
I again ask you to please review the Site FAQ for guidance in posting your questions and general forum usage.
Please edit your post#12 to make it more readable. Also please check if it has any #define in it -- if it is C-language and we are talking about macros, I would expect to see some #define-s.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.