>From: Chris Rehm <javadisciple@earthlink.net>

>>
>The provider of the standard libraries so that the method linked in is
>the MI accessing method.
>
>But again that is a complaint about the compiler. There is no
>requirement that there be some inefficient string processing. Nor is
>there a requirement that only RPG get to use MIs when they suit a purpose.
>
>My contention is that it is not a requirement of "modern programming
>languages" that they be able to burn extra processing cycles. That is a
>requirement of less than optimum compilers and poorly coded standard
>libraries.
>

Chris,

Here is a c++ string class:

Class String {

// two data mbrs. lgth of the string and
// a ptr to string data.
  int mnLgth ;
  char* mpData ;

// an assignment member function.
// user of the class codes as: string1 = string2
// ( some confusing symbols left out )
String operator=( const String string2 ) ;
} ;

// here is the assignment mbr function code.
String String::operator=( const string2 )
{
if ( mpData != NULL )
  {
  free( mpData ) ;  // free old string
  }

// allocate string memory.
  mnLgth = string2.GetLgth( ) ;
  mpData = malloc( mnLgth + 1 ) ;

// store the string value.
  strcpy( mpData, string2.GetBuffer( ) ) ;

  return *this ;
}

The string class is then used in a pgm:
  String sEvilDoer ;
  sEvilDoer = "Ibm leadership" ;

This code takes a lot of cpu to run, is bloat free, abstracts away a bunch of 
details the pgmr does not need to have deal with, does not give much chance to 
optimize and would make our as400 grind to a halt if run as frequently as 
efficient RPG pgms are run.

Steve Richter




This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].