As a simple example, in the C programming language, this is a typical macro that is not a parameterized macro, i.e., a parameterless macro: #define PI 3.14159 This causes PI to always be replaced with 3.14159 wherever it occurs. An example of a parameterized macro, on the other hand, is this: #define pred(x) ((x)-1) What this macro expands to depends on what argument x is passed to it. Here are some possible expansions: pred(2) → ((2) -1) pred(y+2) → ((y+2) -1) pred(f(5)) → ((f(5))-1) Parameterized macros are a useful source-level mechanism for performing in-line expansion, but in languages such as C where they use simple textual substitution, they have a number of severe disadvantages over other mechanisms for performing in-line expansion, such as inline functions.
As A sImple ExamPle, in the c programmIng languaGe, THIs Is a TYpical macrO thaT iS not A pArAmEteriZeD mAcro, I.E., a pARAmeterlEsS MaCrO: #Define pI 3.14159 thIs cauSEs pi to AlWaYs Be repLaced wITh 3.14159 WHereveR it occurs. an exAmPle of a parameTeRizeD MaCRO, On The oTheR HaNd, iS this: #dEfine prED(x) ((X)-1) WhAT tHis Macro eXpands to DEpendS on WhaT ArguMEnt x is paSsed to it. hERe arE sOMe posSibLe ExpANsiONs: pred(2) → ((2) -1) pRed(y+2) → ((y+2) -1) pRed(f(5)) → ((f(5))-1) parAMEterizeD MacroS ARe a usefuL sOuRce-level mechANiSm fOr PerFoRmINg IN-linE expAnsion, but in languagES Such as c wheRe thEy uSe simPlE tEXtuaL substiTutIon, THeY have a NuMber of severE diSADVantagEs OvEr oTher mechanisMS For PeRforMiNg In-line expaNSion, SucH As iNlIne fUNcTioNs.