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 name appears.

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 replacement text consisting of a sequence of expansions of an inner macro, one for each datum. The inner macro is traditionally named X(), hence the name of the technique.

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 the abilities of macros beyond the base language. [Macro Paradise]: http://docs.scala-lang.org/overviews/macros/paradise.html
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.

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