-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
David Crayford
Sent: Friday, February 3, 2023 3:14 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Open XL C++ debugging

On 2/2/23 21:25, Joseph Reichman wrote:
> Thanks
>
> First off, I am assembler programmer by trade I did learn C/C++ doing some 
> TCP/IP stuff from an Assembler Server Started task.

There's a skill to reading documentation. For XL C++ C++11 compatability see 
https://www.ibm.com/docs/en/zos/2.3.0?topic=xcle-c11-compatibility. 
Note that the C++ standard library is *not* mentioned. We'll get to that later.


>
> It would display the data program listing from a sysadata on Windows.

Why? Are you writing a GUI? I can understand you wanting to use an IDE as 
opposed to ISPF but why run anything on Windows that can run on z/OS?


> I would like to use that code on z/os.
>
> If you say clang, is the way to go okay.
>
> You also say use the clang compiler instead of MSVC I hope I don’t end up 
> with a millon more compile errors using clang as everything compiles cleanly 
> using MSVC.

How can you write a cross platform program using MSVC++ without having 
to resort to #ifdef pre-processor nonsense? That's just bonkers.


>
> I debug under Unix.

You are not making any sense. You want to edit/compile/run on windows 
and then debug on Unix? What Unix, z/OS Unix?


>
> Since I am going to run this from z/os its going to be LE with runtime option 
> POSIX(ON) ? right ?
>
> Now as far as the doc for OPEN XL C++
>
> I got a compile error using map::insert invalid call.
>
> CCN5218 (S) The call does not match any parameter list for "insert".
>
> Is referenced the following statement.
> auto ret = procpointer->extsymcollector->insert({ *s, *exsympointer });

You are attempting to insert a record using an rvalue-reference with an 
initializer list. That's not supported by the XL C++ standard library 
which does not support C++11. I already told you that two posts back. 
The function prototype is like so:

template< class P >
std::pair<iterator, bool> insert( P&& value );

Check the doc https://en.cppreference.com/w/cpp/container/map/insert

The Documentation in the above link is from CPP reference which it would seem 
that the IBM XL C++ 2.4 compiler doesn’t support that level 


These are the methods I see supported from XL C++ template library guide

pair<iterator, bool> insert(const value_type& x);
iterator insert(iterator it, const value_type& x);
template<class InIt>
 void insert(InIt first, InIt last);   


If It only can  accommodate a rvalue that is it very limited in scope as you 
can tell I am not C++ expert but an rvalue is only literal or a function that 
would return the specified type

If XL C++ is into at  C++ 11 at what level is it



thanks  

> the compiler initially gave me a problem with '{'
>
> I took it out.
>
> auto ret = procpointer->extsymcollector->insert( *s, *exsympointer );
>
That's also wrong. You need to pass a single lvalue-reference such as 
std::pair (please read the docs).

auto ret = procpointer->extsymcollector->insert( std::pair(*s, *exsympointer) );

I'm not picking holes but the code snippet you posted concerns me. It's 
heavy on pointers and the de-referencing alone makes me think it's poor 
quality. C++ is not C, it has reference types which are absolutely 
essential for RAII. If you have found you are using raw pointers 
allocated with "new" then that's a code smell.


> then I got the above error
>
> My question is if I got to Open XL C++
>
> Regarding documentation for let's say map::inset I would reference Clang/LLVM 
> link you sent me earlier.
>   
>
> I hope I don’t open a pandoras box if I change to clang and re-compile all my 
> windows code.

The question you should be asking yourself is "should I use C++?". C++ 
is a large and complex language and in my experience with colleagues of 
mine who are excellent assembler programmers it can be a struggle to 
become proficient. Why don't you use a simpler language like Python 
which is easy to use and doesn't have portability issues? I'm an 
experienced C/C++ programmer and I certainly wouldn't entertain using 
C++ to process ADATA, when I can do it faster, with less code and less 
bugs in Python.

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

----------------------------------------------------------------------
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