I know I'm a little late to the party but I think I am extremely qualified
to answer this question: for the past nine years I have used MSVS to edit,
syntax check, and in some cases alpha test thousands and thousands of lines
of C++ for a very successful z/OS product. Let me say
- Yes, casts always take a type name, not a variable name.
- Structs in C (but not C++) require the word struct on all declarations:
struct foo {int x; int y;};
foo bar;
is valid in C++ but C requires
struct foo bar;
- If you re-phrase your question as "I wrote some valid C code and it will
not compile with XLC" then you are alleging a defect -- never mind MSVS one
way or the other. I think a defect is unlikely, but as you saw with the
S0C4, certainly possible. You also saw that IBM responds well to allegations
of defects.
- In my nine years I was extremely happy with the compatibility between the
two compilers. Yes, there are of course things that are specific to z/OS.
Yes, there are some recent extensions that were implemented differently. The
worst problem for me seemed to be that MSVC "forgave" certain syntax and
similar errors that XLC did not. Seeing as how my use of MSVC was as a
syntax checker for XLC that was no favor. One example: if I recall correctly
MSVC allows one to take the address of a C++ static const int; the standard
does not, nor does XLC:
static const int foo = 1;
int *bar = &foo; // not valid C++ but accepted by MSVS
(For those of you that are not C++ geeks, a static const int is kind of like
an EQU in assembler: it has a value but occupies no storage, so taking its
address is irrational.)
Also the #pragma pack syntax is different on the two platforms: annoying but
once you figure it out it is easy to write a macro that bridges the gap.
Frankly one of the most annoying things was how far behind the standards XLC
lags. I used MSVS 2010. There was no point in upgrading to a more recent
version because MSVS 2010 is already more advanced with the standards than
XLC V2R3. That is kind of sad. IBM, are you listening?
Charles
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Joseph Reichman
Sent: Thursday, September 26, 2019 4:40 PM
To: [email protected]
Subject: casting with XL C\C++ compiler
Hi
Seems like a lot the casting I was able to do with the Visual Studio C\C++
compiler I am not able to do with XL C\C++ compiler
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN