HDTenEightyP/NetNews huggingface dataset:
From: e.l.ellis@larc.nasa.gov (Erik L. Ellis)
Newsgroups: comp.lang.c++
Subject: REQUEST - C++ book reviews/opinions
Date: 28 Jan 1993 20:06:04 GMT
Organization: NASA Langley Research Center
Distribution: world
Reply-To: e.l.ellis@larc.nasa.gov (Erik L. Ellis)
NNTP-Posting-Host: mac11.larc.nasa.gov
Keywords: book reviews

I'd like to compile opinions on the many introductory C++ books on the 
market.  If those who are familiar with a book or two would care to e-mail me 
a description of a book's distinguishing features, I will summarize and post 
to comp.lang.c++.  Please include some description of your own background so 
that we have some basis from which to interpret your opinions.

My motivation is to determine what book I should buy to teach myself C++ and 
to use as a reference once I am fairly comfortable with the language.  I have 
A BOOK ON C, 2nd Ed. by Kelley and Pohl and found it very helpful when I was 
learning C a few years ago.  I have been attempting to write a Complex.h 
class to teach myself C++ using Lippman's C++ PRIMER, 2nd Ed. as a reference, 
but I've found it rough going.

Lippman does not assume the reader knows C.  There are plenty of examples, 
but it seems that the explainations often just don't go far enough for me.  
Eg., A declaration may be given as an example when I need to see the whole 
definition.  (I should explain that I'm not a computer scientist/programmer 
type, but an engineer for whom programming is a skill that I enjoy 
cultivating).
  
One of the features of Kelley and Pohl's book that I found very helpful was 
the use of a BNF-like (Backus-Naur Form) description of the syntax.  Each 
control statement, expression, etc, was described in BNF.  Kelley and Pohl 
also included a number of example programs followed by a line-by-line 
disection of the code.

I am especially interested in opinions from people who have read:
C++ for C Programmers - by Pohl
C++ Programming Guidelines - by Plum & Saks
C++ The Complete Reference - by Schildt
or who know of a book that describes the language in BNF.

Again, please e-mail your replies (e.l.ellis@larc.nasa.gov), and I will 
summarize and post.

|  ___ Erik L. Ellis _________________  |  NASA, Langley Research Center
|   Office:  804/864-5819 (ans. mach.)  |  Information Systems Division
|     Home:  804/827-1259 (ans. mach.)  |  Mail Stop 152D
|      FAX:  804/864-8672               |  Hampton, VA  23681-0001


Newsgroups: comp.lang.c++,comp.object
From: gisie@wam.umd.edu (Satan)
Subject: Creating Libraries within the Borland IDE
Organization: University of Maryland, College Park
Date: Wed, 27 Jan 1993 15:31:46 GMT

I have created a library of most used functions that we use at
work.  I have a project with all of the .c files in it.  I compile
all of the .c files to get my .obj files, then use tlib from the
command line to create/update our library.

The Borland documentation leads me to believe that I can do all
of this in the IDE without using TLIB from the command line.
Unfortunately, I have scoured the docs and cant find what I am 
looking for:

	Can I manage .c files and choose MAKE without the IDE
	trying to LINK my files to an EXE?

	Can the IDE manage my library(ies) and how do I set
	up a project to do so?

	or

	Just continue to use TLIB from the cli.

Thanks,
Tim

-- 
gisie@wam.umd.edu
"How will these windows affect my final document?"
Newsgroups: comp.lang.c++
From: gene@aee.aee.com (Gene Kochanowsky)
Subject: Dynamic Linking and Sun Sparcs, do they mix?
Keywords: DLL sparc sun dynamic link libraries
Reply-To: gene@aee.aee.com
Organization: Associated Electronic Engineers
Date: Sat, 23 Jan 1993 04:30:30 GMT

Greetings,

	I have a multi-platform project I am working on that requires the
use of DDLs. I know there are many fine products on the PC that support such
things. Does anyone know if there are any developement products that support
DDLs on the Sun, and what version of the SunOS is needed. User preferences 
are welcome.

	
Thanks

Gene Kochanowsky

gene@aee.aee.com
-- 
Gene Kochanowsky                           | "And remember ....
Associated Electronic Engineers, Inc.      |       The better you look ... 
(904)893-6741 Voice, (904)893-2758 Fax     |       the more you will see."
gene@aee.com                               |               Miss Lidia
Newsgroups: comp.lang.c++
From: andras@well.sf.ca.us (Andrew Raskin)
Subject: Re: HELP with File I/O
Organization: Whole Earth 'Lectronic Link
Date: Sun, 24 Jan 1993 19:28:55 GMT


arsen@mindvox.phantom.com (Arsen Pereymer) writes:

>  Hi everyone... I am having some trouble with file I/O... I am new to the
>  field of file i/o... My problem is, is that I want to write to a file in
>  binary mode and then read from the file in binary mode... Here is the
>  source code of what I did so far :#include<stdio.h> #include<conio.h>
>  #include<string.h> #include<malloc.h> #include<dos.h> main() char *line;
>  FILE *in, *out, *read; int i=0;
>          clrscr();
>          in = fopen("c:\\autoexec.bat","r");
>          out = fopen("\\autoexec.dat","wb");
>          for(i = 0;i <= 1;i++) {
>                  line = (char *) malloc(sizeof(line));
>                  fscanf(in,"%s",line);
>                  fprintf(out,"%s",&line);
>                  free(line);  }
>          fclose(in);
>          fclose(out);  char *r;
>          read = fopen("\\autoexec.dat","rb");
>          fscanf(read,"%s",&r);
>          printf("\nName : %s",r);
>          fclose(read);
>          getch();
>          return 0;
>
>
>          Oops.. it messed up... Well anyways it is readable... as you can
>  see from the above I want to convert the autoexec.bat into a binary
>  format... Now The conversion works good... it creates a binary file called
>  "Autoexec.dat"... But I am having trouble with reading line by line from
>  the binary file? Any suggestions? Thanks in advance....
>

I too am interested in this!

thanks!
From: mjk@tik.vtt.fi (Markku Kylanpaa)
Newsgroups: comp.lang.c++
Subject: HP codelibs class library
Date: 25 Jan 1993 13:15:02 GMT
Organization: Technical Research Cenre of Finland
Distribution: world
NNTP-Posting-Host: tik.vtt.fi
Keywords: HP codelibs

HP C++ compiler comes with class library called
codelibs. There are some classes for dynamic arrays,
hashtable etc.

I could not found any information about the origin of this
package in documentation. I guess it is only available
for HP platform. Has anyone used it in non-HP machines?


Markku Kylanpaa
Technical Research Centre of Finland          
Laboratory for Information Processing
Lehtisaarentie 2A  00340 Helsinki FINLAND
E-mail: mjk@tik.vtt.fi
From: peterj@hparc0.aus.hp.com (Peter Westley)
Date: Thu, 21 Jan 1993 05:40:36 GMT
Subject: smart enums
Organization: HP Australasian Response Centre (Melbourne)
Newsgroups: comp.lang.c++
X-Newsreader: Tin 1.1 PL4

I am trying to create a class which implements a "smart enum".  This enum
type will be able recognise itself as both an int (or other integral type)
or as char* and also have stndard conversions to both int and char* for
things sunch as stream insertion.

The way I am trying to implement them is with templates.  Say I wanted
an enum class type which could take the values "Apple", "Banana" and "Pear"
each assigned (an arbitary) int.  Basically to bahave much as an enum normally
does.

In order to do this I decleared a template like:

template <char **l>
class SmartEnum
{
public:
    SmartEnum();
    SmartEnum(char *);
    SmartEnum(int);
    //etc
private:
    int val;
    char **names;
}

template <char **nm> SmartEnum<nm>::SmartEnum()
{
	//what ever
}

The idea being that I could declare a class based on this template which
I could have multiple instances of:

	char *somenames[] = {"Apple","Banana","Pear"};
	char *morenames[] = {"Peter","John","Andrew"};

	typedef SmartEnum<somenames> FruitEnum;
	typedef SmartEnum<morenames> BoysEnum;
	FruitEnum aFruit();
	FruitEnum anotherFruit();
	BoysEnum aBoy();
	BoysEnum anotherBoy();

Then I could do things like:
	aFruit = "Banana";
	anotherFruit = 1;
	aBoy = "Andrew";
	anotherBoy = 1;

And (while I haven't declared these in my example because I'm too lazy) you
could use them like:
	cout << (int)aBoy; //gives "3"
	cout << (char *)anotherBoy; //gives "Peter"
	etc etc

Am I going about this the right way? Have I totally missed something?
Is there A Better Way?  Should I be using templates?

Free comments welcome - even flames!!

Peter Westley			 .-_!\		Hewlett Packard
Phone: +61 3 (T)272 2440        /     \		Australian Support Centre
Fax: +61 3 890 0326      	\_.-.b/<--------31-41 Joseph St.
E-mail: peterj@hparc0.aus.hp.com     v          Blackburn, Victoria 3130
//
// The views, opinions, information or other data here is solely from the
// mind of myself.  It is not the official word from my employer.  While I
// endeavour to provide accurate information, no responsibility is taken
// for errors or omissions.
Newsgroups: comp.lang.c++
From: dave@ait.com
Subject: Distributed transaction processing with a relational database
Reply-To: dave@ait.com
Organization: Artificial Intelligence Technologies, Inc.
Date: Wed, 20 Jan 1993 22:06:49 GMT


We are in the problem analysis phase for a project to move an existing
mainframe transaction processing system using VSAM, to distributed
workstations and a relational database.  The application must handle
about 500,000 existing customers, periodically calling into the
customer service reps. who handle complaints, new products, cancel
products, etc.  These customers need to be billed for their products,
and the product must be transported to the customer.  The total size
of the VSAM files is now about 2-4 gig of data, with some of this
being historical records.  There will be about 100 users of hte
system, with 50-70 fulltime.  Batch processes will also be running
over the data at various times through the cycle.

I am looking for persons out there that have deployed, or are developing
similar applications, and I would like information on how this can be
accomplished most efficiently.  Specifically:

1) What methods/tools did you use if you used OOA or Design?

2) What platform/workstation/servers are prefered for both development
and deployment?

3) What language(s) did you use, C, C++, Cobol, 4GL?  Did you use any CASE
tools?  E.g. What is a _very_ large, deployed system for C++?

4) How about GUIs and their development tools?  Motif, Windows, Forms?
The ideal situation would take advantage of existing PC hardware
running Windows for the infrequent users, and perhaps an Xterm to a
workstation for continous users.

5) Which database tools were used, Sybase, Ingres, Oracle?

6) I am also looking for any literature I can find on _deployed_ systems
similar to this, books, papers, etc.

Thank you for your input,
dave

________________________________________________________________________
Dave Pracht					phone: (914)347-6860
Director of Applications Development		fax: (914)347-3182
Artificial Intelligence Technologies, Inc.	internet: dave@ait.com
Westchester Co. NY
________________________________________________________________________
Newsgroups: comp.lang.c++
From: gs4t@virginia.edu (Gnanasekaran Swaminathan)
Subject: Re: operator = with inheritance
Organization: University of Virginia
Date: Sat, 23 Jan 1993 20:40:10 GMT

nikki@trmphrst.demon.co.uk (Nikki Locke) writes:
: gs4t@virginia.edu (Gnanasekaran Swaminathan) writes:
: > g++ compiler gets this wrong. Probably try a different compiler
: > if you are using g++.
: I am afraid I think it is YOU who has got it wrong !
: 
: I tested the program at the end of this post under Zortech c++ 3.0r4,
: Borland C++ 3.0, and Microsoft C7, and they all gave the following output ...
: 
: B::=(A&)
: B::copy2(A*)
: A::copy2(A*)
: b1.b = 11 b2.b = 22 b1.a = 2 b2.a = 2
: 
: If you follow this through,
: a1=a2; calls the virtual operator B::operator=(const A&)
: B::operator=(const A&) calls virtual function B::copy2(A*), NOT B::copy2(B*),
:   because polymorphism doesn't act on function arguments.
: 
: Did you actually test this on some compiler ? If so, which one ?
: _I_ think it has a bug !

I fixed the gcc compiler myself to run the code as I thought
it was a bug. I see what the problem is now. Thanks for catching
the bug. 

Looks like you have to add a copy2 function to the base class
for every derived class in this technique. There should be a
better way.
Newsgroups: comp.lang.c++
From: tsuanian@cc.curtin.edu.au
Subject: Problem with execl()
Organization: Curtin University of Technology
Date: Fri, 22 Jan 1993 01:02:33 GMT

This isn't a problem with C++ specifically, but it is
hapenning with my BC++ 2.0 Compiler.

I am using the execl function to call another program
after one completes. the line is something like
execl("executor.exe","executor.exe",argv[3],NULL);

ideally this would mean that "executor.exe" would be passed
2 arguements i.e executor.exe and argv[3].  
But when "executor.exe" starts up it has up to 5 arguments!
The first two as expected, and the rest garbage. 
(I discovered this by doing a printf on argc and argv).

Any ideas on why this happens.  I notice that this only happens if
the program with the execl line in it (the calling program) is 
large (i.e greater that 300K or so).

Any opinions?

Thanks
Ian.
-- 
 Internet: TSUANIAN@cc.curtin.edu.au
 Bitnet: TSUANIAN%cc.curtin.edu.au@cunyvm.bitnet
 UUCP  : uunet!munnari.oz!cc.curtin.edu.au!TSUANIAN
Newsgroups: comp.lang.c++
From: xinxu@stam.qe.bell.ca (Xin Xu)
Subject: Re: Reference vs. Pointer
Organization: Telecom Canada E.D.S.
Distribution: na
Date: Fri, 22 Jan 1993 15:09:17 GMT

In article <1993Jan18.192004.2347@taumet.com>, steve@taumet.com (Steve Clamage) writes:
|> steve@taumet.com (Steve Clamage) writes:
|> 
|> >A reference must be initialized to refer to an existing object at its
|> >point of definition, and cannot be changed.  A reference variable can
|> >never be null, and you may safely omit testing for null.  You never have
|> >an uninitialized reference, a source of hard-to-find bugs with pointers.
|> 
|> I had a number of email messages about this, so perhaps some
|> clarification is in order.
|> 
|> Null pointers may always be created using completely valid and portable
|> code, as may uninitialized pointers.  Not so for references.
|> 
|> You can (attempt to) make a null reference, but only by dereferencing
|> a null pointer or by doing something similar with undefined behavior.
|> It may "work" on a given implementation, but need not.
|> 
|> Assuming a reference is not null is as safe as assuming it does not
|> dangle, and probably safer.
|> -- 
|> 
|> Steve Clamage, TauMetric Corp, steve@taumet.com

   Once a reference variable is initialized, the reference binding can not 
be changed. This limits the usage of reference variable.
   What's the meaningful usage of "reference variable"  ?
   The only meaningful usage I can see now is to use reference as function
arguments or function return.  I think that allowing function  to return
reference contributes to the capacity of the language. What's the real stuff
we can do with reference variable if we don't use it as function argument
or function return ? 
What's the meaningful usage of "reference variable" ?
Newsgroups: comp.lang.c++
From: randy@actel.com (Randy Sexton)
Subject: c++ tool called cback??
Keywords: compiler c++ cfront
Organization: Actel Corporation
Distribution: na
Date: Tue, 26 Jan 1993 21:57:41 GMT

Does anyone know who or where the 'cback' tool might be gotten from or 
found?

I hope this is the correct place to put this posting, I have never
done this before, so I apologize if this is not the correct place
to put this.

Thanx in advance.

randy@actel.com

Newsgroups: comp.lang.c++,comp.std.c++
From: rmartin@stripe.Rational.COM (Bob Martin)
Subject: Re: Callbacks -- suggested approaches??
Organization: Rational
Date: Tue, 26 Jan 1993 23:21:17 GMT

davidm@consilium.com (David S. Masterson) writes:

|Processes communicate by passing
|Message objects that contains any necessary data.  The receiving Process
|object looks into the incoming Message, determines its type (a number), and
|dispatches it (via table lookup) to a callback function on the Process object
|that has been previously registered for that type of Message.

Passing messages between processes is always a challenge, especially
when what you really want to do is pass messages between two objects
which happen to live in different processes.  It would be very nice if
the sending and receiving objects did not know that the message was
crossing a process boundary.  Below is described a technique for
achieving this.

Given that class A wants to send the message X to class B.  (This is the
OO concept of a message.  I will refer to the data exchanged between
processes as a packet.)  

	A::f(B* theB)
	{
	  theB->X();
	}

Unfortunately, theB lives in another process.  No problem.  Create an
abstract class called AbstractB.  It contains a set of pure virtual
functions defining all the messages that B can receive.  B will
inherit from AbstractB.  So will another class called BSurrogate.
BSurrogate knows which process the real B object lives in and knows
how to convert the message into a packet and ship it to that process.
The packet will contain all the arguments to X, an identifier denoting
that it represents an X message and the identifier of the B object to
which the message should be sent.

When the process receives the it looks up the name of the object in a
dictionary.  The dictionary associates the name with a derivative of
the class Reciever.  BReceiver is derived from Receiver, and knows how
to unpack the X packet.  It also knows where the B object is (Probably
it contains a pointer to it), so it unpacks all the arguments and then
sends the message to its B object.  

Return values can be passed back by the same route by simply having
the Surrogate add a return address onto the packet.


--
Robert Martin       | Design Consulting    | Training courses offered:
R. C. M. Consulting | rmartin@rational.com |  Object Oriented Analysis
2080 Cranbrook Rd.  | Tel: (708) 918-1004  |  Object Oriented Design
Green Oaks, Il 60048| Fax: (708) 918-1023  |  C++
Newsgroups: comp.lang.c++
From: augs@cypress45.cray.com (Paul Algren)
Subject: Why won't this C++ compile?
Originator: augs@cypress45
Organization: Cray Research, Inc.
Date: 25 Jan 93 10:55:18 CST


Any comments would be interesting on the following code sequence.

Given the following files:

// ############# class1.h ##################
class class2;

class class1 {
    class2* other;

  public:
    class2* class2() {
	return (other);
    }
    void SetClass2(class2*);
};

// ############# class2.h ##################
class class1;

class class2 {
    class1* other;

  public:
    class1* class1() {
	return (other);
    }
    void SetClass1(class1*);
};

// ############# class1.c ##################
#include <class1.h>
#include <class2.h>

void
class1::SetClass2(class class2* c)
{
    other = c;
}

// ############# class2.c ##################
#include <class2.h>
#include <class1.h>

void
class2::SetClass1(class1* c)
{
    other = c;
}

I compile class1.c (CC -c -I. class1.c) and get no errors, but I compile
class2.c and I get the following errors.

(2.1)
CC -c -I. class2.c
"class2.c", line 5: warning: old style definition of SetClass1() (anachronism)
"class2.c", line 8: error:  name expected in argument list
"class2.c", line 5: error:  class2::SetClass1() type mismatch:  void class2::(class1 *) and  void class2::()
Compilation failed

Does someone have an explanation for this?
I can't seem to imagine why the compiler searches the symbols finding
class2::class1() first or at all instead of searching for known classes (types).

The fix in class1.c is to add the class specifier before the classname
explicitly telling the compiler to expect a class name instead of a 
symbol, but why?

When using 3.0 I have the same problem, but there is now another error on the
declaration in the include files.  Now neither class1.c nor class2.c will
compile.

(3.0)
CC-3.0.1 -c -I. class2.c
"./class2.h", line 13: error:  initializer for member SetClass1
"./class2.h", line 13: error: bad base type: void SetClass1
"./class1.h", line 13: error:  initializer for member SetClass2
"./class1.h", line 13: error: bad base type: void SetClass2
"class2.c", line 5: warning: old style definition of SetClass1() (anachronism)
"class2.c", line 6: error:  name expected in argument list
"class2.c", line 5: error:  class2::SetClass1() is not a member of class2
Compilation failed

C-3.0.1 -c -I. class1.c
"./class1.h", line 13: error:  initializer for member SetClass2
"./class1.h", line 13: error: bad base type: void SetClass2
"./class2.h", line 13: error:  initializer for member SetClass1
"./class2.h", line 13: error: bad base type: void SetClass1
"class1.c", line 5: error:  class1::SetClass2() is not a member of class1
Compilation failed

??????,

Paul
From: dal@mdavcr.mda.ca (Dale Lutz)
Newsgroups: comp.lang.c++
Subject: Re: c++ tool called cback??
Date: 28 Jan 93 17:09:51 GMT
Organization: MacDonald Dettwiler, 13800 Commerce Parkway, Richmond, BC, Canada  V6V 2J3

cback is a companion product to cfront based C++ translators.   It
processes the C code that cfront outputs and makes it easier to read,
smaller, and faster.

Normally, when you compile in a cfront based C++ system, the following
flow happens:

 	C++ code ---> cfront ---> C code ---> C compiler ---> object code

With cback, the flow is:  

 	C++ code ---> cfront ---> C code ---> cback ---> smaller C code 
				---> C compiler ---> object code


We have used it quite a bit and have seen miraculous results.
With the OI libraries, the object files were reduced from 
500k to 20k.  On another system we saw an average reduction in object
file size of 50%.  Link times were reduced accordingly, as were executable
sizes.

Overall, this product is a must have.  I think it is around $800 per
floating license.

     Contact:
 
     NewCode Technology Incorporated
     200 Boston Avenue
     Medford, MA 02155
     Tel: (617) 396-3009
     Fax: (617) 395-9452
     internet: zeev%cybvax0@uunet.uu.net
 
(They also make a relatively expense malloc library that
 supposedly gives much increased performance to C++ programs.  We
 plan to evaluate this soon.)


NOTE:  All opinions are my own and I have no stake whatsoever in NewCode.
       They just make a great product I want others to benefit from.

Dale
-- 

---------------------------------------------------------------------------
Dale Lutz      - MacDonald Dettwiler Richmond, BC, CANADA -      dal@mda.ca
From: dliao@aludra.usc.edu (David Liao)
Newsgroups: comp.lang.c++
Subject: Turbo Vision Dialog Editor
Date: 24 Jan 1993 13:28:43 -0800
Organization: University of Southern California, Los Angeles, CA
Distribution: usa
NNTP-Posting-Host: aludra.usc.edu

I heard there is a dialog editor for Turbo Vision C++.  Does anyone
know where I can obtain it?  Preferably a FTP site.


David Liao
dliao@usc.edu
University of Southern California


Newsgroups: comp.lang.c++
From: cicci@hpcnnn.cern.ch (Claudio Condini)
Subject: Equivalent of realloc().
Organization: CERN, European Research Center for Particle Physics
Date: Tue, 26 Jan 1993 12:59:19 GMT


I am implementing a class (in fact, a template) Vector which contains a member
function resize(int).  This should really be implemented with a realloc().  Any
constructor for the Element class of Vector should be called for all and only
the new elements.  That is, if I have a vector with 20 elements of class X and
resize it to 30, then the X::X() constructor should be called only for the 10
extra elements, and the original 20 elements should not be touched.  Is there a
way to do this?  I have tried playing with operator new(size_t, void*) but did
not get very far.

Regards,

Claudio Condini.
Xref: sparky comp.lang.c++:19731 comp.lang.smalltalk:2787 comp.lang.ada:4035 comp.lang.objective-c:724 comp.lang.eiffel:1447