Tutorial by Topics: macros

All preprocessor commands begins with the hash (pound) symbol #. A C macro is just a preprocessor command that is defined using the #define preprocessor directive. During the preprocessing stage, the C preprocessor (a part of the C compiler) simply substitutes the body of the macro wherever its nam...
X-macros are a preprocessor-based technique for minimizing repetitious code and maintaining data / code correspondences. Multiple distinct macro expansions based on a common set of data are supported by representing the whole group of expansions via a single master macro, with that macro's replacem...
A walkthrough of macros can be found in The Rust Programming Language (a.k.a. The Book).
The Purpose of Macros Macros are intended for generating code, transforming code and providing new notations. These new notations can be more suited to better express the program, for example by providing domain-level constructs or entire new embedded languages. Macros can make source code mor...
The main difference between macros and functions is, that macros are evaluated within the current context, while functions open a new scope within the current one. Thus, variables defined within functions are not known after the function has been evaluated. On the contrary, variables within macros...
The ' symbol used in the macroexpand example is just syntactic sugar for the quote operator. You could have written (macroexpand (quote (infix 1 + 2))) instead. Macros are just functions that run at compile time, i.e. during the eval step in a read-eval-print-loop. Reader macros are anothe...
Macros are a form of compile time metaprogramming. Certain elements of Scala code, such as annotations and methods, can be made to transform other code when they are compiled. Macros are ordinary Scala code that operate on data types that represent other code. The [Macro Paradise][] plugin extends t...
macro"string" # short, string macro form @macro_str "string" # long, regular macro form macro`command` String macros are not quite as powerful as plain old strings — because interpolation must be implemented in the macro's logic, string macros are unable to contain str...
\newcommand{\macro}{replacement text} \newcommand{\macro}[argcount]{replacement text} \renewcommand{\macro}{replacement text} \renewcommand{\macro}[argcount]{replacement text} ParameterDetails\macroThe macro to defineargcountThe number of arguments the macro expects (optional)replacement ...
ANSI C defines a number of macros. Although each one is available for your use in programming, the predefined macros should not be directly modified. DATE The current date as a character literal in "MMM DD YYYY" format TIME The current time as a character literal in "HH:MM:SS...
We have new features for Eloquent Relationship in Laravel version 5.4.8. We can fetch a single instance of a hasMany (it is just one example) relationship by define it at on place and it will works for all relationship
Rust 1.15 added (stabilized) a new feature: Custom derive aka Macros 1.1. Now apart from usual PartialEq or Debug you can have #[deriving(MyOwnDerive)]. Two primary users of the feature is serde and diesel. Rust Book link: https://doc.rust-lang.org/stable/book/procedural-macros.html
Also known as arrow macros, threading macros convert nested function calls into a linear flow of function calls.
In a command prompt, you can use DOSKEY for creating macros. In a batch file you can define a variable that can be called as a piece of code and even pass arguments to it.

Page 1 of 1