Re: Question about C++

2017-05-29 Thread Charles Mills
Nearly any "Hello, world" program from the Web will run without modification on 
z/OS, either as a UNIX command or as a conventional load module.

ftp://www.cs.uregina.ca/pub/class/cplusplus/CExample.html 

z Linux is Linux, Linux, Linux. Nearly any Linux program should compile and run 
without modification so long as it does not have "endian" dependencies.

I've got a lot of C++ code but the bulk of it is proprietary. I have some 
trivial programs but they are no more illustrative than anything you could find 
on the Web.

There are any number of C++ tutorials available. The IBM z C++ is totally 
standard, albeit about six years behind the state of the art. There are a 
number of IBM extensions but they are well-documented in the usual places and 
pretty straightforward. For example, in "regular" C you might write FILE myFile 
= fopen("C:/foo/bar.txt, "r"); while in MVS you might write FILE myfile = 
fopen("//SYS1.FOO.BAR(MYMEM)", "r, lrecl=80");

I learned Microsoft Visual C# which was easy -- great visual IDE -- and then 
taught myself C++ from there. I think it was a good way to go. I learned true 
object-oriented habits that way. Many people I fear claim they are writing C++ 
but in reality are writing what I call "C with // comments."

Charles

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Steve Beaver
Sent: Monday, May 29, 2017 1:32 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Question about C++

Does anyone have a complete piece of C++ code that runs under MVS or Linux that 
I can study?  99% of the stuff I write is HLASM and to a point I find C++ 
bewildering.

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


Re: Question about C++

2017-05-29 Thread Mike Schwab
http://www.99-bottles-of-beer.net/language-c++-109.html

On Mon, May 29, 2017 at 3:32 PM, Steve Beaver  wrote:
> Does anyone have a complete piece of C++ code that runs under MVS or Linux 
> that I can study?  99% of the stuff I write is HLASM and to a point I find 
> C++ bewildering.
>
> TIA
>
> Steve
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



-- 
Mike A Schwab, Springfield IL USA
Where do Forest Rangers go to get away from it all?

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


Re: Question about C++

2017-05-30 Thread David Crayford

On 30/05/2017 5:18 AM, Charles Mills wrote:

Nearly any "Hello, world" program from the Web will run without modification on 
z/OS, either as a UNIX command or as a conventional load module.

ftp://www.cs.uregina.ca/pub/class/cplusplus/CExample.html

z Linux is Linux, Linux, Linux. Nearly any Linux program should compile and run without 
modification so long as it does not have "endian" dependencies.

I've got a lot of C++ code but the bulk of it is proprietary. I have some 
trivial programs but they are no more illustrative than anything you could find 
on the Web.

There are any number of C++ tutorials available. The IBM z C++ is totally 
standard, albeit about six years behind the state of the art.


Indeed! only a subset of the C++11 standard has been implemented so far 
and the other platforms already enjoy C++17 which is almost as succinct 
as dynamic languages. At least we have type inference which Java doesn't 
yet. Especially good for iterators to swerve the boiler plate declarations:


for ( auto it = m_map.begin(); it != m_map.end(); it++ ) ...

C++ can be a very complex language with some gnarly edge cases. But if 
you master the fundamentals it it's an incredibly powerful language.



I learned Microsoft Visual C# which was easy -- great visual IDE -- and then taught 
myself C++ from there. I think it was a good way to go. I learned true object-oriented 
habits that way. Many people I fear claim they are writing C++ but in reality are writing 
what I call "C with // comments."


I don't have a problem with using C++ as a better C. Some might use it 
just for scope based resource acquisition or a safe string library. Not 
everybody wants or needs OO abstractions. In a lot of modern C++ code 
generic code (templates) with implicit interfaces is the way to go. I've 
solved so many problems elegantly using templates that would have been 
tedious using classic OO design with virtual functions and dynamic 
dispatch.




Charles

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Steve Beaver
Sent: Monday, May 29, 2017 1:32 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Question about C++

Does anyone have a complete piece of C++ code that runs under MVS or Linux that 
I can study?  99% of the stuff I write is HLASM and to a point I find C++ 
bewildering.

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


Re: Question about C++

2017-05-30 Thread David Crayford
This might bewilder you some more because C++ is a tricky language for a 
beginner. It''s a simple thin wrapper class around C stdio that provides 
RAII and some return value checks that throw exception when errors 
occur. If you can work this out you're well on your way to being 
competent. It's mainly meant as a demonstrator for 
constructors/destructors which are fundamental to C++ programming.


#include 
#include 
#include 
#include 

class File
{
public:
// default constructor
File() : m_file( 0 ) {}

// constructor - opens the file
File( const std::string & filename, const std::string & mode )
: m_file( 0 )
{
std::cout << "constructor\n";
open( filename, mode );
}

// move constructor - takes ownership of the underlying file object
File( File && rhs ) : m_file(0)
{
std::cout << "move constructor\n";
m_file = rhs.m_file;
rhs.m_file = 0;
}

// destructor
~File()
{
close();
}

public:
// opens a file
void open( const std::string & filename, const std::string & mode )
{
std::cout << "opening file " << filename << "\n";
m_file = fopen( filename.c_str(), mode.c_str() );
if (!m_file) throw std::runtime_error( "Error opening file: " + 
std::string( strerror( errno ) ) );

}

// closes the files
void close()
{
if (m_file)
{
std::cout << "closing file\n";
fclose( m_file );
m_file = 0;
}
}

// reads from the file
int read( void * buffer, size_t size )
{
return fread( buffer, 1, size, m_file );
}

// writes to the file
int write( const void * buffer, size_t size )
{
int bytesWritten = fwrite( buffer, 1, size, m_file );
if (bytesWritten == 0) // I/O error
{
throw std::runtime_error( std::string( "Error writing to 
file: " + std::string( strerror( errno ) ) ) );

}
return bytesWritten;
}

private:
FILE * m_file;  // file handle
};

// factory function to demonstrate change of ownership
File openFile( const std::string filename, const std::string & mode )
{
File file( filename, mode );
return file;
}

int main( int argc, char * argv[] )
{
try
{
// open the files
File input = openFile( "DD:INPUT", "rb, type=record, noseek" );
File output( "DD:OUTPUT", "wb, type=record" );
// copy the input file to the output file
size_t bytesRead;
char buffer[32768];
while ( ( bytesRead = input.read( buffer, sizeof buffer ) ) )
{
output.write( buffer, bytesRead );
}
// < destructors run here when the file objects go out of scope
}
catch (std::exception & e)
{
std::cout << e.what() << "\n";
}
return 0;
}



On 30/05/2017 4:32 AM, Steve Beaver wrote:

Does anyone have a complete piece of C++ code that runs under MVS or Linux that 
I can study?  99% of the stuff I write is HLASM and to a point I find C++ 
bewildering.

TIA

Steve

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


Re: Question about C++

2017-05-30 Thread Charles Mills
> I don't have a problem with using C++ as a better C.

Okay, fair enough. Perhaps I was being a bit of an OO snob. It's true. You get 
to pick and choose which features (of any language) suit your style and your 
set of problems.

You're going to gasp at this: I have not found a fondness for the C++ stream 
I/O for messages. I use "printf-style" I/O. I think it is better suited to a 
mainframe product style where all of the messages are organized and documented, 
not just whatever the programmer felt like writing in the particular situation.

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of David Crayford
Sent: Tuesday, May 30, 2017 2:08 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

On 30/05/2017 5:18 AM, Charles Mills wrote:
> Nearly any "Hello, world" program from the Web will run without modification 
> on z/OS, either as a UNIX command or as a conventional load module.
>
> ftp://www.cs.uregina.ca/pub/class/cplusplus/CExample.html
>
> z Linux is Linux, Linux, Linux. Nearly any Linux program should compile and 
> run without modification so long as it does not have "endian" dependencies.
>
> I've got a lot of C++ code but the bulk of it is proprietary. I have some 
> trivial programs but they are no more illustrative than anything you could 
> find on the Web.
>
> There are any number of C++ tutorials available. The IBM z C++ is totally 
> standard, albeit about six years behind the state of the art.

Indeed! only a subset of the C++11 standard has been implemented so far and the 
other platforms already enjoy C++17 which is almost as succinct as dynamic 
languages. At least we have type inference which Java doesn't yet. Especially 
good for iterators to swerve the boiler plate declarations:

for ( auto it = m_map.begin(); it != m_map.end(); it++ ) ...

C++ can be a very complex language with some gnarly edge cases. But if
you master the fundamentals it it's an incredibly powerful language.

> I learned Microsoft Visual C# which was easy -- great visual IDE -- and then 
> taught myself C++ from there. I think it was a good way to go. I learned true 
> object-oriented habits that way. Many people I fear claim they are writing 
> C++ but in reality are writing what I call "C with // comments."

I don't have a problem with using C++ as a better C. Some might use it 
just for scope based resource acquisition or a safe string library. Not 
everybody wants or needs OO abstractions. In a lot of modern C++ code 

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


Re: Question about C++

2017-05-30 Thread Charles Mills
You're trying to scare the poor man!

After I learned OO, I realized the problem in trying to communicate the 
concepts.

- The easy-to-grasp explanations are stupid: Animal is a class. Dog and Cat are 
child classes of Animal. Fido is an instance of Dog. You could have an 
inherited public overridden method Speak() and say myAnimal.Speak() and if it 
were a Dog it would bark and if it were a Cat it would Meow ...

- The real problems that are solved by the significant features are too hard to 
explain in a simple tutorial. I solved a problem the other day with a very 
sparsely-implemented virtual polymorphic method -- but it would take me an hour 
to explain what the problem was.

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of David Crayford
Sent: Tuesday, May 30, 2017 5:23 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

This might bewilder you some more ...

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


Re: Question about C++

2017-05-30 Thread Rugen, Len
I think I still suffer OOD (Object Oriented Disorder) :-)   However, a few 
weeks ago I managed to write a Python program to report on a data structure 
accessed by an OO api that was a fit to using recursion.  

Then I had to try to explain the magic of the html indention...  

Len Rugen

Metrics and Automation – umdoitmetr...@missouri.edu


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Charles Mills
Sent: Tuesday, May 30, 2017 8:53 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

You're trying to scare the poor man!

After I learned OO, I realized the problem in trying to communicate the 
concepts.

- The easy-to-grasp explanations are stupid: Animal is a class. Dog and Cat are 
child classes of Animal. Fido is an instance of Dog. You could have an 
inherited public overridden method Speak() and say myAnimal.Speak() and if it 
were a Dog it would bark and if it were a Cat it would Meow ...

- The real problems that are solved by the significant features are too hard to 
explain in a simple tutorial. I solved a problem the other day with a very 
sparsely-implemented virtual polymorphic method -- but it would take me an hour 
to explain what the problem was.

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of David Crayford
Sent: Tuesday, May 30, 2017 5:23 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

This might bewilder you some more ...

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


Re: Question about C++

2017-05-30 Thread scott Ford
Guys I am trying to learn C++ . I began on C and Ruby and a little of the
snake -- python..

This is GREAT ...

Scott

On Tue, May 30, 2017 at 10:29 AM, Rugen, Len  wrote:

> I think I still suffer OOD (Object Oriented Disorder) :-)   However, a few
> weeks ago I managed to write a Python program to report on a data structure
> accessed by an OO api that was a fit to using recursion.
>
> Then I had to try to explain the magic of the html indention...
>
> Len Rugen
>
> Metrics and Automation – umdoitmetr...@missouri.edu
>
>
> -Original Message-
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of Charles Mills
> Sent: Tuesday, May 30, 2017 8:53 AM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Question about C++
>
> You're trying to scare the poor man!
>
> After I learned OO, I realized the problem in trying to communicate the
> concepts.
>
> - The easy-to-grasp explanations are stupid: Animal is a class. Dog and
> Cat are child classes of Animal. Fido is an instance of Dog. You could have
> an inherited public overridden method Speak() and say myAnimal.Speak() and
> if it were a Dog it would bark and if it were a Cat it would Meow ...
>
> - The real problems that are solved by the significant features are too
> hard to explain in a simple tutorial. I solved a problem the other day with
> a very sparsely-implemented virtual polymorphic method -- but it would take
> me an hour to explain what the problem was.
>
> Charles
>
>
> -Original Message-
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of David Crayford
> Sent: Tuesday, May 30, 2017 5:23 AM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Question about C++
>
> This might bewilder you some more ...
>
> --
> 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
>



-- 



*IDMWORKS *

Scott Ford

z/OS Dev.




“By elevating a friend or Collegue you elevate yourself, by demeaning a
friend or collegue you demean yourself”



www.idmworks.com

scott.f...@idmworks.com

Blog: www.idmworks.com/blog





*The information contained in this email message and any attachment may be
privileged, confidential, proprietary or otherwise protected from
disclosure. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, distribution, copying or
use of this message and any attachment is strictly prohibited. If you have
received this message in error, please notify us immediately by replying to
the message and permanently delete it from your computer and destroy any
printout thereof.*

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


Re: Question about C++

2017-05-30 Thread Kirk Wolf
We use a small subset of C++ (better C) on z/OS:

classes (encapsulation)  (but very little use of inheritance)
RIAA
exceptions
better type checking
improved syntax (like late declaration of variables)
inlining of functions in class header  (and very little use of function
macro)


Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Tue, May 30, 2017 at 7:22 AM, David Crayford  wrote:

> This might bewilder you some more because C++ is a tricky language for a
> beginner. It''s a simple thin wrapper class around C stdio that provides
> RAII and some return value checks that throw exception when errors occur.
> If you can work this out you're well on your way to being competent. It's
> mainly meant as a demonstrator for constructors/destructors which are
> fundamental to C++ programming.
>
> #include 
> #include 
> #include 
> #include 
>
> class File
> {
> public:
> // default constructor
> File() : m_file( 0 ) {}
>
> // constructor - opens the file
> File( const std::string & filename, const std::string & mode )
> : m_file( 0 )
> {
> std::cout << "constructor\n";
> open( filename, mode );
> }
>
> // move constructor - takes ownership of the underlying file object
> File( File && rhs ) : m_file(0)
> {
> std::cout << "move constructor\n";
> m_file = rhs.m_file;
> rhs.m_file = 0;
> }
>
> // destructor
> ~File()
> {
> close();
> }
>
> public:
> // opens a file
> void open( const std::string & filename, const std::string & mode )
> {
> std::cout << "opening file " << filename << "\n";
> m_file = fopen( filename.c_str(), mode.c_str() );
> if (!m_file) throw std::runtime_error( "Error opening file: " +
> std::string( strerror( errno ) ) );
> }
>
> // closes the files
> void close()
> {
> if (m_file)
> {
> std::cout << "closing file\n";
> fclose( m_file );
> m_file = 0;
> }
> }
>
> // reads from the file
> int read( void * buffer, size_t size )
> {
> return fread( buffer, 1, size, m_file );
> }
>
> // writes to the file
> int write( const void * buffer, size_t size )
> {
> int bytesWritten = fwrite( buffer, 1, size, m_file );
> if (bytesWritten == 0) // I/O error
> {
> throw std::runtime_error( std::string( "Error writing to file:
> " + std::string( strerror( errno ) ) ) );
> }
> return bytesWritten;
> }
>
> private:
> FILE * m_file;  // file handle
> };
>
> // factory function to demonstrate change of ownership
> File openFile( const std::string filename, const std::string & mode )
> {
> File file( filename, mode );
> return file;
> }
>
> int main( int argc, char * argv[] )
> {
> try
> {
> // open the files
> File input = openFile( "DD:INPUT", "rb, type=record, noseek" );
> File output( "DD:OUTPUT", "wb, type=record" );
> // copy the input file to the output file
> size_t bytesRead;
> char buffer[32768];
> while ( ( bytesRead = input.read( buffer, sizeof buffer ) ) )
> {
> output.write( buffer, bytesRead );
> }
> // < destructors run here when the file objects go out of scope
> }
> catch (std::exception & e)
> {
> std::cout << e.what() << "\n";
> }
> return 0;
>
> }
>
>
>
> On 30/05/2017 4:32 AM, Steve Beaver wrote:
>
>> Does anyone have a complete piece of C++ code that runs under MVS or
>> Linux that I can study?  99% of the stuff I write is HLASM and to a point I
>> find C++ bewildering.
>>
>> TIA
>>
>> Steve
>>
>> --
>> 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
>

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


Re: Question about C++

2017-05-30 Thread Steve Smith
C++ is my favorite language (I was historically a PL/I fan), but it's a
deep pool to get into.  Decent object-oriented programming requires
learning a whole bunch of new ways to do things, and think about things.
There are many layers now of functionality, and there's no serious "Learn
C++ In Seven Days" book any more.  The language has grown and expanded
quite a bit past where my knowledge and experience ends.

But I definitely agree that's it's useful as "enhanced C".  But as you
learn more, you can implement more and better patterns... try not to rush
it too much, and free advice: write, don't read (code).  There may be a
1000 ways to do things wrong in assembler, but there's billions in C++.  So
be careful about the examples you emulate.  The founder of C++ said
something like "You can shoot yourself in the foot with any language, but
with C++, it'll blow your leg clean off."

Eventually, the big problem with OOP is designing an intelligent class
hierarchy to solve a particular problem.  And that is where so many go
wrong.  The real world of applications rarely comes up with something as
obvious as Thing: Animal/Vegetable/Mineral. Animal: Cat/Dog.

And then you can get into templates, and whatever new & crazy stuff they've
thought of recently.  It's a whole new world, lots of fun, but it gets a
long long way away from what you're probably used to in assembly (or C for
that matter).  But again, a subset of C++ is useful and valuable; you don't
have to (and it's probably insane to) use every feature.

sas

On Tue, May 30, 2017 at 12:18 PM, Kirk Wolf  wrote:

> We use a small subset of C++ (better C) on z/OS:
>
> classes (encapsulation)  (but very little use of inheritance)
> RIAA
> exceptions
> better type checking
> improved syntax (like late declaration of variables)
> inlining of functions in class header  (and very little use of function
> macro)
>
>
> Kirk Wolf
> Dovetailed Technologies
> http://dovetail.com
>
> On Tue, May 30, 2017 at 7:22 AM, David Crayford 
> wrote:
>
> > This might bewilder you some more because C++ is a tricky language for a
> > beginner. It''s a simple thin wrapper class around C stdio that provides
> > RAII and some return value checks that throw exception when errors occur.
> > If you can work this out you're well on your way to being competent. It's
> > mainly meant as a demonstrator for constructors/destructors which are
> > fundamental to C++ programming.
> >
> > #include 
> > #include 
> > #include 
> > #include 
> >
> > class File
> > {
> > public:
> > // default constructor
> > File() : m_file( 0 ) {}
> >
> > // constructor - opens the file
> > File( const std::string & filename, const std::string & mode )
> > : m_file( 0 )
> > {
> > std::cout << "constructor\n";
> > open( filename, mode );
> > }
> >
> > // move constructor - takes ownership of the underlying file object
> > File( File && rhs ) : m_file(0)
> > {
> > std::cout << "move constructor\n";
> > m_file = rhs.m_file;
> > rhs.m_file = 0;
> > }
> >
> > // destructor
> > ~File()
> > {
> > close();
> > }
> >
> > public:
> > // opens a file
> > void open( const std::string & filename, const std::string & mode )
> > {
> > std::cout << "opening file " << filename << "\n";
> > m_file = fopen( filename.c_str(), mode.c_str() );
> > if (!m_file) throw std::runtime_error( "Error opening file: " +
> > std::string( strerror( errno ) ) );
> > }
> >
> > // closes the files
> > void close()
> > {
> > if (m_file)
> > {
> > std::cout << "closing file\n";
> > fclose( m_file );
> > m_file = 0;
> > }
> > }
> >
> > // reads from the file
> > int read( void * buffer, size_t size )
> > {
> > return fread( buffer, 1, size, m_file );
> > }
> >
> > // writes to the file
> > int write( const void * buffer, size_t size )
> > {
> > int bytesWritten = fwrite( buffer, 1, size, m_file );
> > if (bytesWritten == 0) // I/O error
> > {
> > throw std::runtime_error( std::string( "Error writing to
> file:
> > " + std::string( strerror( errno ) ) ) );
> > }
> > return bytesWritten;
> > }
> >
> > private:
> > FILE * m_file;  // file handle
> > };
> >
> > // factory function to demonstrate change of ownership
> > File openFile( const std::string filename, const std::string & mode )
> > {
> > File file( filename, mode );
> > return file;
> > }
> >
> > int main( int argc, char * argv[] )
> > {
> > try
> > {
> > // open the files
> > File input = openFile( "DD:INPUT", "rb, type=record, noseek" );
> > File output( "DD:OUTPUT", "wb, type=record" );
> > // copy the input file to the output file
> > size_t bytesRead;
> > char buffer[32768];
> > while ( ( bytesRead = inpu

Re: Question about C++

2017-05-30 Thread David Crayford

On 30/05/2017 9:52 PM, Charles Mills wrote:

You're trying to scare the poor man!

After I learned OO, I realized the problem in trying to communicate the 
concepts.

- The easy-to-grasp explanations are stupid: Animal is a class. Dog and Cat are 
child classes of Animal. Fido is an instance of Dog. You could have an 
inherited public overridden method Speak() and say myAnimal.Speak() and if it 
were a Dog it would bark and if it were a Cat it would Meow ...


Agreed. Inheritance should generally be avoided anyway. It has it's 
place but composition should be preferred 9 times out of 10. Inheritance 
is tightly coupled and can become incomprehensible once it gets a few 
layers deep.



- The real problems that are solved by the significant features are too hard to 
explain in a simple tutorial. I solved a problem the other day with a very 
sparsely-implemented virtual polymorphic method -- but it would take me an hour 
to explain what the problem was.


Polymorphism is the key principle and you don't need an OO language to 
use it. Any language with function pointers can implement polymorphism. 
A case in point is the z/OS C stdio runtime which supports many 
different types of data source. fopen() is the factory function which 
populates the read/write (virtual) function pointers in the FILE 
structure. There's no reason why you can't write OO code in assembler. I 
see lots of assembler code with constitutional logic littered throughout 
which call different functions depending on some type which would 
benefit from an OO design.



Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of David Crayford
Sent: Tuesday, May 30, 2017 5:23 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

This might bewilder you some more ...

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


Re: Question about C++

2017-05-30 Thread scott Ford
Guys,

Where does this old Dino find readable examples in OO programming say in
c++?  I am trying to learn it.

Regards,

Scott
On Tue, May 30, 2017 at 10:46 PM David Crayford  wrote:

> On 30/05/2017 9:52 PM, Charles Mills wrote:
> > You're trying to scare the poor man!
> >
> > After I learned OO, I realized the problem in trying to communicate the
> concepts.
> >
> > - The easy-to-grasp explanations are stupid: Animal is a class. Dog and
> Cat are child classes of Animal. Fido is an instance of Dog. You could have
> an inherited public overridden method Speak() and say myAnimal.Speak() and
> if it were a Dog it would bark and if it were a Cat it would Meow ...
>
> Agreed. Inheritance should generally be avoided anyway. It has it's
> place but composition should be preferred 9 times out of 10. Inheritance
> is tightly coupled and can become incomprehensible once it gets a few
> layers deep.
>
> > - The real problems that are solved by the significant features are too
> hard to explain in a simple tutorial. I solved a problem the other day with
> a very sparsely-implemented virtual polymorphic method -- but it would take
> me an hour to explain what the problem was.
>
> Polymorphism is the key principle and you don't need an OO language to
> use it. Any language with function pointers can implement polymorphism.
> A case in point is the z/OS C stdio runtime which supports many
> different types of data source. fopen() is the factory function which
> populates the read/write (virtual) function pointers in the FILE
> structure. There's no reason why you can't write OO code in assembler. I
> see lots of assembler code with constitutional logic littered throughout
> which call different functions depending on some type which would
> benefit from an OO design.
>
> > Charles
> >
> >
> > -Original Message-
> > From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU]
> On Behalf Of David Crayford
> > Sent: Tuesday, May 30, 2017 5:23 AM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Re: Question about C++
> >
> > This might bewilder you some more ...
> >
> > --
> > 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
>
-- 
Scott Ford
IDMWORKS
z/OS Development

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


Re: Question about C++

2017-05-30 Thread Lizette Koehler
Will this help?

https://www.tutorialspoint.com/cplusplus/cpp_object_oriented.htm

Lizette


> -Original Message-
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of scott Ford
> Sent: Tuesday, May 30, 2017 7:58 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Question about C++
> 
> Guys,
> 
> Where does this old Dino find readable examples in OO programming say in
> c++?  I am trying to learn it.
> 
> Regards,
> 
> Scott
> On Tue, May 30, 2017 at 10:46 PM David Crayford  wrote:
> 
> > On 30/05/2017 9:52 PM, Charles Mills wrote:
> > > You're trying to scare the poor man!
> > >
> > > After I learned OO, I realized the problem in trying to communicate
> > > the
> > concepts.
> > >
> > > - The easy-to-grasp explanations are stupid: Animal is a class. Dog
> > > and
> > Cat are child classes of Animal. Fido is an instance of Dog. You could
> > have an inherited public overridden method Speak() and say
> > myAnimal.Speak() and if it were a Dog it would bark and if it were a Cat it
> would Meow ...
> >
> > Agreed. Inheritance should generally be avoided anyway. It has it's
> > place but composition should be preferred 9 times out of 10.
> > Inheritance is tightly coupled and can become incomprehensible once it
> > gets a few layers deep.
> >
> > > - The real problems that are solved by the significant features are
> > > too
> > hard to explain in a simple tutorial. I solved a problem the other day
> > with a very sparsely-implemented virtual polymorphic method -- but it
> > would take me an hour to explain what the problem was.
> >
> > Polymorphism is the key principle and you don't need an OO language to
> > use it. Any language with function pointers can implement polymorphism.
> > A case in point is the z/OS C stdio runtime which supports many
> > different types of data source. fopen() is the factory function which
> > populates the read/write (virtual) function pointers in the FILE
> > structure. There's no reason why you can't write OO code in assembler.
> > I see lots of assembler code with constitutional logic littered
> > throughout which call different functions depending on some type which
> > would benefit from an OO design.
> >
> > > Charles
> > >
> > >
> > > -Original Message-
> > > From: IBM Mainframe Discussion List
> > > [mailto:IBM-MAIN@LISTSERV.UA.EDU]
> > On Behalf Of David Crayford
> > > Sent: Tuesday, May 30, 2017 5:23 AM
> > > To: IBM-MAIN@LISTSERV.UA.EDU
> > > Subject: Re: Question about C++
> > >
> > > This might bewilder you some more ...
> > >
> > > 
> > > -- 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
> >
> --
> Scott Ford
> IDMWORKS
> z/OS Development
> 
> --
> 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


Re: Question about C++

2017-05-30 Thread scott Ford
Liz,

Perfecto, a big try..

Regards,

Scott

On Tue, May 30, 2017 at 11:23 PM Lizette Koehler 
wrote:

> Will this help?
>
> https://www.tutorialspoint.com/cplusplus/cpp_object_oriented.htm
>
> Lizette
>
>
> > -Original Message-
> > From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> > Behalf Of scott Ford
> > Sent: Tuesday, May 30, 2017 7:58 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Re: Question about C++
> >
> > Guys,
> >
> > Where does this old Dino find readable examples in OO programming say in
> > c++?  I am trying to learn it.
> >
> > Regards,
> >
> > Scott
> > On Tue, May 30, 2017 at 10:46 PM David Crayford 
> wrote:
> >
> > > On 30/05/2017 9:52 PM, Charles Mills wrote:
> > > > You're trying to scare the poor man!
> > > >
> > > > After I learned OO, I realized the problem in trying to communicate
> > > > the
> > > concepts.
> > > >
> > > > - The easy-to-grasp explanations are stupid: Animal is a class. Dog
> > > > and
> > > Cat are child classes of Animal. Fido is an instance of Dog. You could
> > > have an inherited public overridden method Speak() and say
> > > myAnimal.Speak() and if it were a Dog it would bark and if it were a
> Cat it
> > would Meow ...
> > >
> > > Agreed. Inheritance should generally be avoided anyway. It has it's
> > > place but composition should be preferred 9 times out of 10.
> > > Inheritance is tightly coupled and can become incomprehensible once it
> > > gets a few layers deep.
> > >
> > > > - The real problems that are solved by the significant features are
> > > > too
> > > hard to explain in a simple tutorial. I solved a problem the other day
> > > with a very sparsely-implemented virtual polymorphic method -- but it
> > > would take me an hour to explain what the problem was.
> > >
> > > Polymorphism is the key principle and you don't need an OO language to
> > > use it. Any language with function pointers can implement polymorphism.
> > > A case in point is the z/OS C stdio runtime which supports many
> > > different types of data source. fopen() is the factory function which
> > > populates the read/write (virtual) function pointers in the FILE
> > > structure. There's no reason why you can't write OO code in assembler.
> > > I see lots of assembler code with constitutional logic littered
> > > throughout which call different functions depending on some type which
> > > would benefit from an OO design.
> > >
> > > > Charles
> > > >
> > > >
> > > > -Original Message-
> > > > From: IBM Mainframe Discussion List
> > > > [mailto:IBM-MAIN@LISTSERV.UA.EDU]
> > > On Behalf Of David Crayford
> > > > Sent: Tuesday, May 30, 2017 5:23 AM
> > > > To: IBM-MAIN@LISTSERV.UA.EDU
> > > > Subject: Re: Question about C++
> > > >
> > > > This might bewilder you some more ...
> > > >
> > > > 
> > > > -- 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
> > >
> > --
> > Scott Ford
> > IDMWORKS
> > z/OS Development
> >
> > --
> > 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
>
-- 
Scott Ford
IDMWORKS
z/OS Development

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


Re: Question about C++

2017-05-31 Thread Charles Mills
See the example that @David Crayford posted on this thread on Tuesday. Great 
intro to some basic concepts.

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of scott Ford
Sent: Tuesday, May 30, 2017 7:58 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

Guys,

Where does this old Dino find readable examples in OO programming say in
c++?  I am trying to learn it.

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


Re: Question about C++

2017-05-31 Thread Charles Mills
> There's no reason why you can't write OO code in assembler.

And there's no reason you could not write OO code by keying the bits in through 
a debugger.

The point of the OO constructs is not that there is no other way to do things. 
Obviously, any object program that can be produced by a compiler could have 
been written in HLASM.

The point of OO constructs is never having to say "was there something I was 
supposed to call when I was finished with this record (DSECT, struct, class, 
...)?" What was its name? Where is the pointer to it? What are the calling 
parameters? Or worse, I just realized I am going to need a cleanup routine for 
this record. Now I have to go back and make sure that every piece of code that 
uses it gets modified to call the cleanup routine. You just delete the class 
and if it has a destructor, it gets called. Voila!

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of David Crayford
Sent: Tuesday, May 30, 2017 7:46 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

On 30/05/2017 9:52 PM, Charles Mills wrote:
> You're trying to scare the poor man!
>
> After I learned OO, I realized the problem in trying to communicate the 
> concepts.
>
> - The easy-to-grasp explanations are stupid: Animal is a class. Dog and Cat 
> are child classes of Animal. Fido is an instance of Dog. You could have an 
> inherited public overridden method Speak() and say myAnimal.Speak() and if it 
> were a Dog it would bark and if it were a Cat it would Meow ...

Agreed. Inheritance should generally be avoided anyway. It has it's place but 
composition should be preferred 9 times out of 10. Inheritance is tightly 
coupled and can become incomprehensible once it gets a few layers deep.

> - The real problems that are solved by the significant features are too hard 
> to explain in a simple tutorial. I solved a problem the other day with a very 
> sparsely-implemented virtual polymorphic method -- but it would take me an 
> hour to explain what the problem was.

Polymorphism is the key principle and you don't need an OO language to use it. 
Any language with function pointers can implement polymorphism. 
A case in point is the z/OS C stdio runtime which supports many different types 
of data source. fopen() is the factory function which populates the read/write 
(virtual) function pointers in the FILE structure. There's no reason why you 
can't write OO code in assembler. I see lots of assembler code with 
constitutional logic littered throughout which call different functions 
depending on some type which would benefit from an OO design.

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


Re: Question about C++

2017-05-31 Thread David Crayford

On 31/05/2017 8:13 AM, Steve Smith wrote:

Eventually, the big problem with OOP is designing an intelligent class
hierarchy to solve a particular problem.  And that is where so many go
wrong.  The real world of applications rarely comes up with something as
obvious as Thing: Animal/Vegetable/Mineral. Animal: Cat/Dog.


I would argue that deep class hierarchies are a bad code smell. I would 
advise any wannabe C++ developer to get a copy of "Design Patterns" by 
the gang of four.
It was written in 1994 but still stands strong today. It emphasizes 
composition over inheritance and it's legacy can be seen today in 
runtimes like the Java JRE.
As you say, language semantics are secondary to good design and that 
book is a classic that changed the way the industry thought about OOP 
based up experience.



And then you can get into templates, and whatever new & crazy stuff they've
thought of recently.  It's a whole new world, lots of fun, but it gets a
long long way away from what you're probably used to in assembly (or C for
that matter).  But again, a subset of C++ is useful and valuable; you don't
have to (and it's probably insane to) use every feature.

sas

On Tue, May 30, 2017 at 12:18 PM, Kirk Wolf  wrote:


We use a small subset of C++ (better C) on z/OS:

classes (encapsulation)  (but very little use of inheritance)
RIAA
exceptions
better type checking
improved syntax (like late declaration of variables)
inlining of functions in class header  (and very little use of function
macro)


Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Tue, May 30, 2017 at 7:22 AM, David Crayford 
wrote:


This might bewilder you some more because C++ is a tricky language for a
beginner. It''s a simple thin wrapper class around C stdio that provides
RAII and some return value checks that throw exception when errors occur.
If you can work this out you're well on your way to being competent. It's
mainly meant as a demonstrator for constructors/destructors which are
fundamental to C++ programming.

#include 
#include 
#include 
#include 

class File
{
public:
 // default constructor
 File() : m_file( 0 ) {}

 // constructor - opens the file
 File( const std::string & filename, const std::string & mode )
 : m_file( 0 )
 {
 std::cout << "constructor\n";
 open( filename, mode );
 }

 // move constructor - takes ownership of the underlying file object
 File( File && rhs ) : m_file(0)
 {
 std::cout << "move constructor\n";
 m_file = rhs.m_file;
 rhs.m_file = 0;
 }

 // destructor
 ~File()
 {
 close();
 }

public:
 // opens a file
 void open( const std::string & filename, const std::string & mode )
 {
 std::cout << "opening file " << filename << "\n";
 m_file = fopen( filename.c_str(), mode.c_str() );
 if (!m_file) throw std::runtime_error( "Error opening file: " +
std::string( strerror( errno ) ) );
 }

 // closes the files
 void close()
 {
 if (m_file)
 {
 std::cout << "closing file\n";
 fclose( m_file );
 m_file = 0;
 }
 }

 // reads from the file
 int read( void * buffer, size_t size )
 {
 return fread( buffer, 1, size, m_file );
 }

 // writes to the file
 int write( const void * buffer, size_t size )
 {
 int bytesWritten = fwrite( buffer, 1, size, m_file );
 if (bytesWritten == 0) // I/O error
 {
 throw std::runtime_error( std::string( "Error writing to

file:

" + std::string( strerror( errno ) ) ) );
 }
 return bytesWritten;
 }

private:
 FILE * m_file;  // file handle
};

// factory function to demonstrate change of ownership
File openFile( const std::string filename, const std::string & mode )
{
 File file( filename, mode );
 return file;
}

int main( int argc, char * argv[] )
{
 try
 {
 // open the files
 File input = openFile( "DD:INPUT", "rb, type=record, noseek" );
 File output( "DD:OUTPUT", "wb, type=record" );
 // copy the input file to the output file
 size_t bytesRead;
 char buffer[32768];
 while ( ( bytesRead = input.read( buffer, sizeof buffer ) ) )
 {
 output.write( buffer, bytesRead );
 }
 // < destructors run here when the file objects go out of

scope

 }
 catch (std::exception & e)
 {
 std::cout << e.what() << "\n";
 }
 return 0;

}



On 30/05/2017 4:32 AM, Steve Beaver wrote:


Does anyone have a complete piece of C++ code that runs under MVS or
Linux that I can study?  99% of the stuff I write is HLASM and to a

point I

find C++ bewildering.

TIA

Steve

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

Re: Question about C++

2017-05-31 Thread David Crayford
I think I should have used the term object based for non-OO languages. 
Scope based finalization is a sweet spot of C++ with scoped based 
destructors. I'm coding a lot of Java at the moment and having to code 
finally blocks or use the try-with-resources statement is tedious. But 
my point was mainly about polymorphism and how it can be implemented in 
languages that have function pointers. Of course, in a language that has 
no destructors or finalization you have to explicitly call a destructor.


Here is a nifty piece of C++ code that wraps the C stdio FILE structure 
which implements RAII to call fclose() by using a implicit pointer 
operator! It's one of the many C++ features many people are not aware 
of. Props to Jerry Coffin who invented it.


|classfile {typedefFILE*ptr;ptr wrapped_file;public:file(std::string 
const&name,std::string const&mode 
=std::string("r")):wrapped_file(fopen(name.c_str(),mode.c_str())){}operatorptr()const{returnwrapped_file;}~file(){if(wrapped_file)fclose(wrapped_file);}}; 
- 
||file f("myfile.txt","w");if(!f){fprintf(stderr,"Unable to open 
file\n");return0;}fprintf(f,"Hello world");|



On 31/05/2017 9:06 PM, Charles Mills wrote:

There's no reason why you can't write OO code in assembler.

And there's no reason you could not write OO code by keying the bits in through 
a debugger.

The point of the OO constructs is not that there is no other way to do things. 
Obviously, any object program that can be produced by a compiler could have 
been written in HLASM.

The point of OO constructs is never having to say "was there something I was 
supposed to call when I was finished with this record (DSECT, struct, class, ...)?" 
What was its name? Where is the pointer to it? What are the calling parameters? Or worse, 
I just realized I am going to need a cleanup routine for this record. Now I have to go 
back and make sure that every piece of code that uses it gets modified to call the 
cleanup routine. You just delete the class and if it has a destructor, it gets called. 
Voila!

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of David Crayford
Sent: Tuesday, May 30, 2017 7:46 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

On 30/05/2017 9:52 PM, Charles Mills wrote:

You're trying to scare the poor man!

After I learned OO, I realized the problem in trying to communicate the 
concepts.

- The easy-to-grasp explanations are stupid: Animal is a class. Dog and Cat are 
child classes of Animal. Fido is an instance of Dog. You could have an 
inherited public overridden method Speak() and say myAnimal.Speak() and if it 
were a Dog it would bark and if it were a Cat it would Meow ...

Agreed. Inheritance should generally be avoided anyway. It has it's place but 
composition should be preferred 9 times out of 10. Inheritance is tightly 
coupled and can become incomprehensible once it gets a few layers deep.


- The real problems that are solved by the significant features are too hard to 
explain in a simple tutorial. I solved a problem the other day with a very 
sparsely-implemented virtual polymorphic method -- but it would take me an hour 
to explain what the problem was.

Polymorphism is the key principle and you don't need an OO language to use it. 
Any language with function pointers can implement polymorphism.
A case in point is the z/OS C stdio runtime which supports many different types 
of data source. fopen() is the factory function which populates the read/write 
(virtual) function pointers in the FILE structure. There's no reason why you 
can't write OO code in assembler. I see lots of assembler code with 
constitutional logic littered throughout which call different functions 
depending on some type which would benefit from an OO design.

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


Re: Question about C++

2017-05-31 Thread John McKown
On Wed, May 31, 2017 at 8:26 AM, David Crayford  wrote:

> I think I should have used the term object based for non-OO languages.
> Scope based finalization is a sweet spot of C++ with scoped based
> destructors. I'm coding a lot of Java at the moment and having to code
> finally blocks or use the try-with-resources statement is tedious. But my
> point was mainly about polymorphism and how it can be implemented in
> languages that have function pointers. Of course, in a language that has no
> destructors or finalization you have to explicitly call a destructor.
>
> Here is a nifty piece of C++ code that wraps the C stdio FILE structure
> which implements RAII to call fclose() by using a implicit pointer
> operator! It's one of the many C++ features many people are not aware of.
> Props to Jerry Coffin who invented it.
>
> |classfile {typedefFILE*ptr;ptr wrapped_file;public:file(std::string
> const&name,std::string const&mode =std::string("r")):wrapped_fil
> e(fopen(name.c_str(),mode.c_str())){}operatorptr()const{re
> turnwrapped_file;}~file(){if(wrapped_file)fclose(wrapped_file);}};
> -
> ||file f("myfile.txt","w");if(!f){fprintf(stderr,"Unable to open
> file\n");return0;}fprintf(f,"Hello world");|
>
> ​​
​It appears to me that the last section, containing code, does not have any
proper line breaks. I can't read it. And I don't know enough C++ to
reformat it. ​



-- 
Windows. A funny name for a operating system that doesn't let you see
anything.

Maranatha! <><
John McKown

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


Re: Question about C++

2017-05-31 Thread David Crayford

Good spot!

class file {
typedef FILE *ptr;

ptr wrapped_file;
public:
file(std::string const &name, std::string const &mode = 
std::string("r")) :

wrapped_file(fopen(name.c_str(), mode.c_str()))
{ }

operator ptr() const { return wrapped_file; }

~file() { if (wrapped_file) fclose(wrapped_file); }
};

-

file f("myfile.txt", "w");

if (!f) {
   fprintf(stderr, "Unable to open file\n");
   return 0;
}

fprintf(f, "Hello world");


On 31/05/2017 9:36 PM, John McKown wrote:

On Wed, May 31, 2017 at 8:26 AM, David Crayford  wrote:


I think I should have used the term object based for non-OO languages.
Scope based finalization is a sweet spot of C++ with scoped based
destructors. I'm coding a lot of Java at the moment and having to code
finally blocks or use the try-with-resources statement is tedious. But my
point was mainly about polymorphism and how it can be implemented in
languages that have function pointers. Of course, in a language that has no
destructors or finalization you have to explicitly call a destructor.

Here is a nifty piece of C++ code that wraps the C stdio FILE structure
which implements RAII to call fclose() by using a implicit pointer
operator! It's one of the many C++ features many people are not aware of.
Props to Jerry Coffin who invented it.

|classfile {typedefFILE*ptr;ptr wrapped_file;public:file(std::string
const&name,std::string const&mode =std::string("r")):wrapped_fil
e(fopen(name.c_str(),mode.c_str())){}operatorptr()const{re
turnwrapped_file;}~file(){if(wrapped_file)fclose(wrapped_file);}};
-
||file f("myfile.txt","w");if(!f){fprintf(stderr,"Unable to open
file\n");return0;}fprintf(f,"Hello world");|

​​

​It appears to me that the last section, containing code, does not have any
proper line breaks. I can't read it. And I don't know enough C++ to
reformat it. ​





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


Re: Question about C++

2017-05-31 Thread David Crayford

Re-posted due to formatting issues:

I think I should have used the term object based for non-OO languages. 
Scope based finalization is a sweet spot of C++ with scoped based 
destructors. I'm coding a lot of Java at the moment and having to code 
finally blocks or use the try-with-resources statement is tedious. But 
my point was mainly about polymorphism and how it can be implemented in 
languages that have function pointers. Of course, in a language that has 
no destructors or finalization you have to explicitly call a destructor.


Here is a nifty piece of C++ code that wraps the C stdio FILE structure 
which implements RAII to call fclose() by using a implicit pointer 
operator! It's one of the many C++ features many people are not aware 
of. Props to Jerry Coffin who invented it.


class file {
typedef FILE *ptr;

ptr wrapped_file;
public:
file(std::string const &name, std::string const &mode = 
std::string("r")) :

wrapped_file(fopen(name.c_str(), mode.c_str()))
{ }

operator ptr() const { return wrapped_file; }

~file() { if (wrapped_file) fclose(wrapped_file); }
};

-

file f("myfile.txt", "w");

if (!f) {
   fprintf(stderr, "Unable to open file\n");
   return 0;
}

fprintf(f, "Hello world");


On 31/05/2017 9:06 PM, Charles Mills wrote:

There's no reason why you can't write OO code in assembler.

And there's no reason you could not write OO code by keying the bits in through 
a debugger.

The point of the OO constructs is not that there is no other way to do things. 
Obviously, any object program that can be produced by a compiler could have 
been written in HLASM.

The point of OO constructs is never having to say "was there something I was 
supposed to call when I was finished with this record (DSECT, struct, class, ...)?" 
What was its name? Where is the pointer to it? What are the calling parameters? Or worse, 
I just realized I am going to need a cleanup routine for this record. Now I have to go 
back and make sure that every piece of code that uses it gets modified to call the 
cleanup routine. You just delete the class and if it has a destructor, it gets called. 
Voila!

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of David Crayford
Sent: Tuesday, May 30, 2017 7:46 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

On 30/05/2017 9:52 PM, Charles Mills wrote:

You're trying to scare the poor man!

After I learned OO, I realized the problem in trying to communicate the 
concepts.

- The easy-to-grasp explanations are stupid: Animal is a class. Dog and Cat are 
child classes of Animal. Fido is an instance of Dog. You could have an 
inherited public overridden method Speak() and say myAnimal.Speak() and if it 
were a Dog it would bark and if it were a Cat it would Meow ...

Agreed. Inheritance should generally be avoided anyway. It has it's place but 
composition should be preferred 9 times out of 10. Inheritance is tightly 
coupled and can become incomprehensible once it gets a few layers deep.


- The real problems that are solved by the significant features are too hard to 
explain in a simple tutorial. I solved a problem the other day with a very 
sparsely-implemented virtual polymorphic method -- but it would take me an hour 
to explain what the problem was.

Polymorphism is the key principle and you don't need an OO language to use it. 
Any language with function pointers can implement polymorphism.
A case in point is the z/OS C stdio runtime which supports many different types 
of data source. fopen() is the factory function which populates the read/write 
(virtual) function pointers in the FILE structure. There's no reason why you 
can't write OO code in assembler. I see lots of assembler code with 
constitutional logic littered throughout which call different functions 
depending on some type which would benefit from an OO design.

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


Re: Question about C++

2017-05-31 Thread John McKown
On Wed, May 31, 2017 at 8:41 AM, David Crayford  wrote:

> Re-posted due to formatting issues:


​Thanks. Much easier to understand.


>
> I think I should have used the term object based for non-OO languages.
> Scope based finalization is a sweet spot of C++ with scoped based
> destructors. I'm coding a lot of Java at the moment and having to code
> finally blocks or use the try-with-resources statement is tedious. But my
> point was mainly about polymorphism and how it can be implemented in
> languages that have function pointers. Of course, in a language that has no
> destructors or finalization you have to explicitly call a destructor.
>
> Here is a nifty piece of C++ code that wraps the C stdio FILE structure
> which implements RAII to call fclose() by using a implicit pointer
> operator! It's one of the many C++ features many people are not aware of.
> Props to Jerry Coffin who invented it.
>
> class file {
> typedef FILE *ptr;
>
> ptr wrapped_file;
> public:
> file(std::string const &name, std::string const &mode =
> std::string("r")) :
> wrapped_file(fopen(name.c_str(), mode.c_str()))
> { }
>
> operator ptr() const { return wrapped_file; }
>
> ~file() { if (wrapped_file) fclose(wrapped_file); }
> };
>
> 
> -
>
> file f("myfile.txt", "w");
>
> if (!f) {
>fprintf(stderr, "Unable to open file\n");
>return 0;
> }
>
> fprintf(f, "Hello world");
>
>
> On 31/05/2017 9:06 PM, Charles Mills wrote:
>
>> There's no reason why you can't write OO code in assembler.
>>>
>> And there's no reason you could not write OO code by keying the bits in
>> through a debugger.
>>
>> The point of the OO constructs is not that there is no other way to do
>> things. Obviously, any object program that can be produced by a compiler
>> could have been written in HLASM.
>>
>> The point of OO constructs is never having to say "was there something I
>> was supposed to call when I was finished with this record (DSECT, struct,
>> class, ...)?" What was its name? Where is the pointer to it? What are the
>> calling parameters? Or worse, I just realized I am going to need a cleanup
>> routine for this record. Now I have to go back and make sure that every
>> piece of code that uses it gets modified to call the cleanup routine. You
>> just delete the class and if it has a destructor, it gets called. Voila!
>>
>> Charles
>>
>>
>> -Original Message-
>> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
>> Behalf Of David Crayford
>> Sent: Tuesday, May 30, 2017 7:46 PM
>> To: IBM-MAIN@LISTSERV.UA.EDU
>> Subject: Re: Question about C++
>>
>> On 30/05/2017 9:52 PM, Charles Mills wrote:
>>
>>> You're trying to scare the poor man!
>>>
>>> After I learned OO, I realized the problem in trying to communicate the
>>> concepts.
>>>
>>> - The easy-to-grasp explanations are stupid: Animal is a class. Dog and
>>> Cat are child classes of Animal. Fido is an instance of Dog. You could have
>>> an inherited public overridden method Speak() and say myAnimal.Speak() and
>>> if it were a Dog it would bark and if it were a Cat it would Meow ...
>>>
>> Agreed. Inheritance should generally be avoided anyway. It has it's place
>> but composition should be preferred 9 times out of 10. Inheritance is
>> tightly coupled and can become incomprehensible once it gets a few layers
>> deep.
>>
>> - The real problems that are solved by the significant features are too
>>> hard to explain in a simple tutorial. I solved a problem the other day with
>>> a very sparsely-implemented virtual polymorphic method -- but it would take
>>> me an hour to explain what the problem was.
>>>
>> Polymorphism is the key principle and you don't need an OO language to
>> use it. Any language with function pointers can implement polymorphism.
>> A case in point is the z/OS C stdio runtime which supports many different
>> types of data source. fopen() is the factory function which populates the
>> read/write (virtual) function pointers in the FILE structure. There's no
>> reason why you can't write OO code in assembler. I see lots of assembler
>> code with constitutional logic littered throughout which call different
>> functions depending on some type which would benefit from an OO design.
>>
>> 

Re: Question about C++

2017-05-31 Thread David Crayford
And I should have called it the implicit conversion operator. It's a 
good example of how to use C++ as a better C to make use of destructors.



On 31/05/2017 9:41 PM, David Crayford wrote:

Re-posted due to formatting issues:

I think I should have used the term object based for non-OO languages. 
Scope based finalization is a sweet spot of C++ with scoped based 
destructors. I'm coding a lot of Java at the moment and having to code 
finally blocks or use the try-with-resources statement is tedious. But 
my point was mainly about polymorphism and how it can be implemented 
in languages that have function pointers. Of course, in a language 
that has no destructors or finalization you have to explicitly call a 
destructor.


Here is a nifty piece of C++ code that wraps the C stdio FILE 
structure which implements RAII to call fclose() by using a implicit 
pointer operator! It's one of the many C++ features many people are 
not aware of. Props to Jerry Coffin who invented it.


class file {
typedef FILE *ptr;

ptr wrapped_file;
public:
file(std::string const &name, std::string const &mode = 
std::string("r")) :

wrapped_file(fopen(name.c_str(), mode.c_str()))
{ }

operator ptr() const { return wrapped_file; }

~file() { if (wrapped_file) fclose(wrapped_file); }
};

- 



file f("myfile.txt", "w");

if (!f) {
   fprintf(stderr, "Unable to open file\n");
   return 0;
}

fprintf(f, "Hello world");


On 31/05/2017 9:06 PM, Charles Mills wrote:

There's no reason why you can't write OO code in assembler.
And there's no reason you could not write OO code by keying the bits 
in through a debugger.


The point of the OO constructs is not that there is no other way to 
do things. Obviously, any object program that can be produced by a 
compiler could have been written in HLASM.


The point of OO constructs is never having to say "was there 
something I was supposed to call when I was finished with this record 
(DSECT, struct, class, ...)?" What was its name? Where is the pointer 
to it? What are the calling parameters? Or worse, I just realized I 
am going to need a cleanup routine for this record. Now I have to go 
back and make sure that every piece of code that uses it gets 
modified to call the cleanup routine. You just delete the class and 
if it has a destructor, it gets called. Voila!


Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] 
On Behalf Of David Crayford

Sent: Tuesday, May 30, 2017 7:46 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

On 30/05/2017 9:52 PM, Charles Mills wrote:

You're trying to scare the poor man!

After I learned OO, I realized the problem in trying to communicate 
the concepts.


- The easy-to-grasp explanations are stupid: Animal is a class. Dog 
and Cat are child classes of Animal. Fido is an instance of Dog. You 
could have an inherited public overridden method Speak() and say 
myAnimal.Speak() and if it were a Dog it would bark and if it were a 
Cat it would Meow ...
Agreed. Inheritance should generally be avoided anyway. It has it's 
place but composition should be preferred 9 times out of 10. 
Inheritance is tightly coupled and can become incomprehensible once 
it gets a few layers deep.


- The real problems that are solved by the significant features are 
too hard to explain in a simple tutorial. I solved a problem the 
other day with a very sparsely-implemented virtual polymorphic 
method -- but it would take me an hour to explain what the problem was.
Polymorphism is the key principle and you don't need an OO language 
to use it. Any language with function pointers can implement 
polymorphism.
A case in point is the z/OS C stdio runtime which supports many 
different types of data source. fopen() is the factory function which 
populates the read/write (virtual) function pointers in the FILE 
structure. There's no reason why you can't write OO code in 
assembler. I see lots of assembler code with constitutional logic 
littered throughout which call different functions depending on some 
type which would benefit from an OO design.


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


Re: Question about C++

2017-05-31 Thread Paul Gilmartin
On Wed, 31 May 2017 06:06:39 -0700, Charles Mills wrote:
>
>The point of the OO constructs is not that there is no other way to do things. 
>Obviously, any object program that can be produced by a compiler could have 
>been written in HLASM.
> 
... but you may need to use the PUNCH statement.  At least that was
the case through assembler H.

-- gil

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


Re: Question about C++

2017-05-31 Thread Kirk Wolf
I would agree with some of what you say Steve, but  I've used C++ for over
25 years and I still don't like it much :-)

Other languages that I have used intensely like Smalltalk and Java
eventually fade into the background after you master them.   The people
that I know that like C++ the most seem to appreciate its endless
complexity.   That said, a subset of C++ with some tiny assembler routines
is for us the best choice for most of what we write on z/OS.

Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Tue, May 30, 2017 at 7:13 PM, Steve Smith  wrote:

> C++ is my favorite language (I was historically a PL/I fan), but it's a
> deep pool to get into.  Decent object-oriented programming requires
> learning a whole bunch of new ways to do things, and think about things.
> There are many layers now of functionality, and there's no serious "Learn
> C++ In Seven Days" book any more.  The language has grown and expanded
> quite a bit past where my knowledge and experience ends.
>
> But I definitely agree that's it's useful as "enhanced C".  But as you
> learn more, you can implement more and better patterns... try not to rush
> it too much, and free advice: write, don't read (code).  There may be a
> 1000 ways to do things wrong in assembler, but there's billions in C++.  So
> be careful about the examples you emulate.  The founder of C++ said
> something like "You can shoot yourself in the foot with any language, but
> with C++, it'll blow your leg clean off."
>
> Eventually, the big problem with OOP is designing an intelligent class
> hierarchy to solve a particular problem.  And that is where so many go
> wrong.  The real world of applications rarely comes up with something as
> obvious as Thing: Animal/Vegetable/Mineral. Animal: Cat/Dog.
>
> And then you can get into templates, and whatever new & crazy stuff they've
> thought of recently.  It's a whole new world, lots of fun, but it gets a
> long long way away from what you're probably used to in assembly (or C for
> that matter).  But again, a subset of C++ is useful and valuable; you don't
> have to (and it's probably insane to) use every feature.
>
> sas
>
> On Tue, May 30, 2017 at 12:18 PM, Kirk Wolf  wrote:
>
> > We use a small subset of C++ (better C) on z/OS:
> >
> > classes (encapsulation)  (but very little use of inheritance)
> > RIAA
> > exceptions
> > better type checking
> > improved syntax (like late declaration of variables)
> > inlining of functions in class header  (and very little use of function
> > macro)
> >
> >
> > Kirk Wolf
> > Dovetailed Technologies
> > http://dovetail.com
> >
> > On Tue, May 30, 2017 at 7:22 AM, David Crayford 
> > wrote:
> >
> > > This might bewilder you some more because C++ is a tricky language for
> a
> > > beginner. It''s a simple thin wrapper class around C stdio that
> provides
> > > RAII and some return value checks that throw exception when errors
> occur.
> > > If you can work this out you're well on your way to being competent.
> It's
> > > mainly meant as a demonstrator for constructors/destructors which are
> > > fundamental to C++ programming.
> > >
> > > #include 
> > > #include 
> > > #include 
> > > #include 
> > >
> > > class File
> > > {
> > > public:
> > > // default constructor
> > > File() : m_file( 0 ) {}
> > >
> > > // constructor - opens the file
> > > File( const std::string & filename, const std::string & mode )
> > > : m_file( 0 )
> > > {
> > > std::cout << "constructor\n";
> > > open( filename, mode );
> > > }
> > >
> > > // move constructor - takes ownership of the underlying file object
> > > File( File && rhs ) : m_file(0)
> > > {
> > > std::cout << "move constructor\n";
> > > m_file = rhs.m_file;
> > > rhs.m_file = 0;
> > > }
> > >
> > > // destructor
> > > ~File()
> > > {
> > > close();
> > > }
> > >
> > > public:
> > > // opens a file
> > > void open( const std::string & filename, const std::string & mode )
> > > {
> > > std::cout << "opening file " << filename << "\n";
> > > m_file = fopen( filename.c_str(), mode.c_str() );
> > > if (!m_file) throw std::runtime_error( "Error opening file: " +
> > > std::string( strerror( errno ) ) );
> > > }
> > >
> > > // closes the files
> > > void close()
> > > {
> > > if (m_file)
> > > {
> > > std::cout << "closing file\n";
> > > fclose( m_file );
> > > m_file = 0;
> > > }
> > > }
> > >
> > > // reads from the file
> > > int read( void * buffer, size_t size )
> > > {
> > > return fread( buffer, 1, size, m_file );
> > > }
> > >
> > > // writes to the file
> > > int write( const void * buffer, size_t size )
> > > {
> > > int bytesWritten = fwrite( buffer, 1, size, m_file );
> > > if (bytesWritten == 0) // I/O error
> > > {
> > > throw std::r

Re: Question about C++

2017-05-31 Thread Steve Smith
On Wed, May 31, 2017 at 10:30 AM, Kirk Wolf  wrote:

> ...  The people that I know that like C++ the most seem to appreciate its
> endless
> complexity.   ...


I might be a tiny bit guilty.  But for real work, I think the real genius
is figuring out how to make a program as simple as possible (but no
simpler).

sas

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


Re: Question about C++

2017-05-31 Thread Barkow, Eileen
It seems to me that java is becoming just as complex as C++,  at least what you 
have to know of it to pass the certification exam.
I have been studying some sample java certification exams and cannot understand 
how anyone can pass them without  lots and lots and lots of study.
Most of the questions consists of trying to predict what the compiler will do 
with some convoluted code no one would actually program;
 and it gets even more hairy  with the new lambda expressions, predicates and 
other
Shorthand expressions  supposedly designed to  make things easier but just 
complicates the predictions.
And many of the questions require selecting 2,3,4 or more multiple choice 
answers and getting any part wrong means that the entire question is marked in 
error.

Having to remember the fine, intricate points of various methods and classes 
which can easily be looked up in the API if programming,
And predicting what could easily be run thru the compiler, is not a real 
measure of knowing how to program.
I have known people who knew all the obscure details of a compiler but who were 
not able to code a simple program  on their own.
And since these certification exams cost about $300-$400 a pop to take,   I 
think that some of them are just a money grabbing stunt.

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Steve Smith
Sent: Wednesday, May 31, 2017 10:50 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

On Wed, May 31, 2017 at 10:30 AM, Kirk Wolf  wrote:

> ...  The people that I know that like C++ the most seem to appreciate its
> endless
> complexity.   ...


I might be a tiny bit guilty.  But for real work, I think the real genius
is figuring out how to make a program as simple as possible (but no
simpler).

sas

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



This e-mail, including any attachments, may be confidential, privileged or 
otherwise legally protected. It is intended only for the addressee. If you 
received this e-mail in error or from someone who was not authorized to send it 
to you, do not disseminate, copy or otherwise use this e-mail or its 
attachments. Please notify the sender immediately by reply e-mail and delete 
the e-mail from your system.

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


Re: Question about C++

2017-05-31 Thread John McKown
On Wed, May 31, 2017 at 10:32 AM, Barkow, Eileen 
wrote:

> It seems to me that java is becoming just as complex as C++,  at least
> what you have to know of it to pass the certification exam.
> I have been studying some sample java certification exams and cannot
> understand how anyone can pass them without  lots and lots and lots of
> study.
> Most of the questions consists of trying to predict what the compiler will
> do with some convoluted code no one would actually program;
>  and it gets even more hairy  with the new lambda expressions, predicates
> and other
> Shorthand expressions  supposedly designed to  make things easier but just
> complicates the predictions.
> And many of the questions require selecting 2,3,4 or more multiple choice
> answers and getting any part wrong means that the entire question is marked
> in error.
>
> Having to remember the fine, intricate points of various methods and
> classes which can easily be looked up in the API if programming,
> And predicting what could easily be run thru the compiler, is not a real
> measure of knowing how to program.
> I have known people who knew all the obscure details of a compiler but who
> were not able to code a simple program  on their own.
> And since these certification exams cost about $300-$400 a pop to take,
>  I think that some of them are just a money grabbing stunt.
>
>
​I completely agree with your assertions. Most "certificates" can most
easily be acquired by an "idiot savant" who can memorize, but not really
think creatively. IMO, a big part of programming is really stating the
problem "properly". The question's phrasing often "suggests"  the approach
to the answer.​ So a bad phrasing can cause a bad answer.

When I do Java programming, I use a Java IDE, such as Netbeans or Eclipse.
ISPF edit is a _joke_ compared to these tools. And, with them, it is far
easier to program. With Netbeans, for example, I can simply point it to the
JAR file and JavaDoc directories to have in-editor contextual help. And it
can easily reformat code to standards. Or even refactor it if I need to
make some more complicated internal changes. A good IDE takes care of the
"housecleaning" for us.


-- 
Windows. A funny name for a operating system that doesn't let you see
anything.

Maranatha! <><
John McKown

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


Re: Question about C++

2017-05-31 Thread David Crayford
Java is a much simpler language then C++. For starters there is no 
undefined behavior, everything is in the spec. The new lambda 
expressions are a welcome addition but as a language it lacks features 
that languages like C# have in abundance. The one saving grace is 
annotations which a lot of Java gurus dislike.



On 31/05/2017 11:32 PM, Barkow, Eileen wrote:

It seems to me that java is becoming just as complex as C++,  at least what you 
have to know of it to pass the certification exam.
I have been studying some sample java certification exams and cannot understand 
how anyone can pass them without  lots and lots and lots of study.
Most of the questions consists of trying to predict what the compiler will do 
with some convoluted code no one would actually program;
  and it gets even more hairy  with the new lambda expressions, predicates and 
other
Shorthand expressions  supposedly designed to  make things easier but just 
complicates the predictions.
And many of the questions require selecting 2,3,4 or more multiple choice 
answers and getting any part wrong means that the entire question is marked in 
error.

Having to remember the fine, intricate points of various methods and classes 
which can easily be looked up in the API if programming,
And predicting what could easily be run thru the compiler, is not a real 
measure of knowing how to program.
I have known people who knew all the obscure details of a compiler but who were 
not able to code a simple program  on their own.
And since these certification exams cost about $300-$400 a pop to take,   I 
think that some of them are just a money grabbing stunt.

-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Steve Smith
Sent: Wednesday, May 31, 2017 10:50 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Question about C++

On Wed, May 31, 2017 at 10:30 AM, Kirk Wolf  wrote:


...  The people that I know that like C++ the most seem to appreciate its
endless
complexity.   ...


I might be a tiny bit guilty.  But for real work, I think the real genius
is figuring out how to make a program as simple as possible (but no
simpler).

sas

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



This e-mail, including any attachments, may be confidential, privileged or 
otherwise legally protected. It is intended only for the addressee. If you 
received this e-mail in error or from someone who was not authorized to send it 
to you, do not disseminate, copy or otherwise use this e-mail or its 
attachments. Please notify the sender immediately by reply e-mail and delete 
the e-mail from your system.

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