Keep in mind that the metalanguage for C and C++ is horribly crude; it can't do the sorts of things that make macro attractive in other languages.
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List [[email protected]] on behalf of Charles Mills [[email protected]] Sent: Monday, April 5, 2021 1:23 PM To: [email protected] Subject: Re: Meta languages [was: RE: Assembler Language Programming for IBM System z Servers] > But IMHO none easy to learn or use. I am generally not a fan of meta languages at all. I think writing programs is hard enough, without having to write two effective programs: one that runs at compile time and one that runs at run time. In my C++, which is now my primary language, I eschew the use of C macros as much as reasonably possible. Reasonableness is a key here. For a few things, macros make sense. One example. I have a lot of bi-modal code: it runs "production" on z/OS and "limited unit test" on Windows. Rather than wrap block after block with #ifdef WIN32 or #ifdef __MVS__, I do that once, in a "universal" header file #ifdef WIN32 static const bool IsZOS = false; #else static const bool IsZOS = true; #endif Then anywhere in the code I can write if (IsZOS) {z/OS specific code} else {Windows specific code} I think it's a lot easier to read, and there is no runtime performance penalty. The z/OS optimizing compiler is smart enough to totally eliminate conditionals based on a constant. Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Farley, Peter x23353 Sent: Monday, April 5, 2021 9:31 AM To: [email protected] Subject: Meta languages [was: RE: Assembler Language Programming for IBM System z Servers] True. There is m4 in *ix systems and going back a long time there was ML/1 (I think there was an academic book published on that one, I think I have a copy somewhere around here). Undoubtedly others I do not know of or remember. Probably also Wirth's "literate programming" suite, TeX I think it is called. But IMHO none easy to learn or use. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
