I realize I also left out one line of the problem.
*For the macro invocation*
STRINGZ(The, quick, brown, fox);
the compiler is making of it
printf("%fox %s %s %s %s\n", 5, "The", "quick", "brown", "fox");
the compiler is making of it:
printf("%fox %s %s %s %s\n", 5, "The", "quick", "brown", "fox");
Charles
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Charles Mills
Sent: Monday, September 01, 2014 1:54 PM
To: [email protected]
Subject: IBM C compiler substituting for macros inside literals?
An associate is seeing very strange (apparent) C compiler behavior. z/OS
V2R1. I would be interested in feedback and comments.
Consider the following:
#define V 5
#define STRINGZ(a,b,c,d) printf("%d %s %s %s %s\n", V, #a, #b, #c, #d)
Here is what the compiler is making of it:
printf("%fox %s %s %s %s\n", 5, "The", "quick", "brown", "fox");
That is, it is apparently substituting parameter d, "fox", for the d in the
first printf() argument.
Neither the MS VS C compiler nor the gnu C compiler appear to behave this
way.
I see the behavior only under USS with the cp command; not from an MVS batch
compile (although I have not yet figured out all of the variables).
Charles
----------------------------------------------------------------------
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