On 2019-09-26 19:07, Jon Perryman wrote:
Seriously! The most sophisticated C macro possible is "#DEFINE MYMAC  B C D ". Calling the macro 
"A  MYMAC Y" results in "A B C D E". Additional macro substitution could occur for B, C 
or D if they exist. How is this anything more than copy?

C/C++ supports function-like macros that accept parameters and can be used to generate large blocks of code if desired. There are good reasons for not doing this, but the capability exists.

The following example program contains two macro definitions and a macro invocation that refers to both of the defined macros:

CCNRAA8

/**This example illustrates #define directives.**/

void printf(const char*, ...);
#define SQR(s)  ((s) * (s))
#define PRNT(a,b) \
  printf("value 1 = %d\n", a); \
  printf("value 2 = %d\n", b)

int main(void)
{
  int x = 2;
  int y = 3;

     PRNT(SQR(x),y);

  return(0);
}

Example lifted from
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.cbclx01/define.htm

--

Regards, Gord Tomlin
Action Software International
(a division of Mazda Computer Corporation)
Tel: (905) 470-7113, Fax: (905) 470-6507
Support: https://actionsoftware.com/support/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to