HDTenEightyP/NetNews huggingface dataset:
From: kanze@us-es.sel.de (James Kanze)
Subject: Re: Query regarding constructor taking void (*f)(...) as arg
Organization: SEL
Date: 9 Oct 92 17:25:41

In <1992Oct06.182933.23489@watson.ibm.com>, Josh Mittleman writes:

|> > void f(int a) {int b = a;}
|> > class bar {
|> >     public:
|> > 	bar::bar(void (*f)(...) ...) {int a = 1;}
|> > };
|> > main () {bar b(f,1);}
|> > 
|> > The complaint is that the constructor invocation bar b(f,1) does not
|> > match the argument list for bar::bar.

|> The error is correct: ... is a part of the signature of the function.  At
|> invocation, the ... may match any string of arguments, but that doesn't
|> mean that the type (*)(int) is the same as (*)(...).  I believe you can
|> think of it this way: ... is a special signature which allows a special
|> part of the compiler's function-matching algorithm to come into play when
|> resolving an invocation.  Otherwise, it is treated just like any other
|> signature, and it can only match another ...  Thus, the first argument to
|> your constructor must have type void (*)(...)

|> > In case you're curious, what I'm trying to do here is to construce
|> > a type that takes a function name and a variable list of parameter types
|> > as arguments and later executes the function.

|> I don't think your approach can work.  ... is not an argument; it is simply
|> an indication that there may or may not be more arguments stored somewhere
|> in memory.  Recall that the only portable way to access those arguments is
|> the va_list macros.  To use those, you _must_ have an argument before the
|> ... from which to reference.  A function like f(...) cannot access its
|> arguments.  

|> You might be able to manage what you want by constructing the va_list and
|> storing a reference to it.  However, I don't know how long a va_list is
|> valid, nor how many you can keep around at the same time.  It isn't a true
|> object, so the construction of the second va_list may corrupt the first.  I
|> guess it depends on how they are implemented.

As far as I know, a va_list *is* an object.  In fact, if my memory
serves me right, it's supposed to be an array type.  You can have as
many as you want (but only one in a given invocation).

As an object, a va_list can be passed as a parameter.  (This is
actually done in the library function vprintf.)  So the correct
solution is to declare f to take *one* parameter, a va_list, and then
do the va_start and va_end in the program which calls f.
--
James Kanze                         GABI Software, Sarl
email: kanze@us-es.sel.de           8 rue du Faisan
                                    67000 Strasbourg
                                    France

Newsgroups: comp.lang.c++
From: sdm@cs.brown.edu (Scott Meyers)
Subject: Re: Another Good C++ Book!
Organization: Brown University Department of Computer Science
Date: Sat, 10 Oct 1992 15:26:18 GMT

In article <1992Oct9.235734.1107@netcom.com> feustel@netcom.com (David Feustel) writes:
| "Effective C++: 50 Specific Ways to Improve Your Programs and Designs"
| by Scott Meyers(ISBN 0-201-56364-9, $24.95, Addison Wesley).
| 
| This book covers so many ways that you can hang yourself in C++ that I
| wonder why someone doesn't write a Lint++ that checks for all of them.

I'm glad you like the book.  There is currently a project at Brown
University that is working on the development of a lint++-like tool, but it
will offer much more power than lint, because you'll be able to write your
own constraints and then have the system look for violations.  For more
information, take a look at this paper:

@CONFERENCE{ccel,
        AUTHOR = {Carolyn K. Duby and Scott Meyers and Steven P. Reiss},
        TITLE = {{CCEL: A Metalanguage for C++}},
        BOOKTITLE = {USENIX C++ Conference Proceedings},
        YEAR = {1992},
        MONTH = aug
}

I will also arrange for this to be installed as a Brown University
Technical Report on wilma.cs.brown.edu.  From there you will be able to
grab it via anonymous ftp.  I don't know how long it will take for the
installation to take place -- figure about a week.

Scott


-------------------------------------------------------------------------------
What do you say to a convicted felon in Providence?  "Hello, Mr. Mayor."
From: vrm@hawksnest.cerc.wvu.wvnet.edu (Vasile R. Montan)
Newsgroups: comp.lang.c++
Subject: TCP communication of NIH objects
Date: 15 Oct 92 20:13:29 GMT
Organization: Concurrent Engineering Research Center


   I apologize if this article has alread been posted, but our network
was down and I am afraid it didn't get out.

   I have been trying to send and receive NIH objects accross an
internet connection by creating a socket and using it as file
descriptor in creating an OIOfd object.  I then use the storeOn and
readFrom methods of the NIH Object class to send and receive objects.
From my limited experience with communications, this seems as though
it should work, but it does not work reliably.

   I have tested this on a Sun sparc with OS 4.1.  It appears to work
fine as long as the client and server are running on the same machine.

1. Should this be a reliable means of communication?  In which case I
   am just doing something wrong.

2. Is there a better way to send and receive objects than the method I
   am using?

I have included the heart of my code below.  To save space, I am
leaving out a lot.  If anyone would like to see the whole thing, I
will mail it to you.

server:
  sockfd = socket(AF_INET, SOCK_STREAM, 0)
  ...
  bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)
  ...
  listen(sockfd, 0);
  for ( ; ; ) {
    clilen = sizeof(cli_addr);
    newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
    ...
    OIOifd in(newsockfd);
    Object *theObject = Object::readFrom(in);
    ...
    close(newsockfd);
  }
  close(sockfd);


client:
  sockfd = socket(AF_INET, SOCK_STREAM, 0)
  ...
  connect(sockfd, (const struct sockaddr *) &serv_addr, sizeof(serv_addr))
  ....
  OIOofd out(sockfd);
  ...
  theObject.storeOn(out);
  close(sockfd);
From: lg2g+@andrew.cmu.edu (Liam David Gray)
Newsgroups: comp.lang.c++
Subject: HELP Bor C++ 3.1 Windows DDE
Date: 11 Oct 92 04:39:11 GMT
Article-I.D.: andrew.Ieq21jK00WB301g1kY
Organization: Sophomore, Electrical and Computer Engineering, Carnegie Mellon, Pittsburgh, PA

Hello.  I'm writing a piece of Windows software another language and I'd
really like to use DDE to exchange data with another Windows app that I
created in Borland C++.  Can I put DDE support into my BC++ apps?  The
other language [Realizer BASIC] lacks a few essential data and control
structures but -- nicely -- DOES support DDE!

I'm sure some of you will suggest that I use a DLL [Realizer BASIC
*does* in fact support DLL's also] but the specific application I'm
thinking of makes DDE look like a better prospect.

Please respond to lg2g@andrew.cmu.edu.  I'll post a summary of any
replies I get.

Thanks.
Liam Gray        lg2g@andrew.cmu.edu
Newsgroups: comp.lang.c++
From: cameron@cosc.canterbury.ac.nz (C. Farquhar)
Subject: What's wrong with these 2 lines of BC++ code ???
Organization: Computer Science,University of Canterbury,New Zealand
Date: Fri, 16 Oct 1992 02:10:54 GMT

  
    TShouldDelete::DeleteType dt = TShouldDelete::NoDelete;
    ComponentList->detach( ComponentList->peekHead(), dt);
    
  
  All I want to do is delete an item from the list..but in the case of this
  example it deletes the first item in the list..I can't see
  what I've done wrong !! The code compiles but requires reboot
  of MSWindows if it is run.  The objects in the component list
  contain lists themselves. I can add Components, iterate over it
  and even destroy the list.. but I can't detach single objects..(SCREAM -
  SCREAM - SCREAM )
  
  Borland C++ has ABSOLUTELY no example code using List containers
  that use detach !!!!

  Have I used TShouldDelete correctly ??
    
  Any ideas.. ?????

 Thanks
 Cameron.
From: grant@pentagon-gw.army.mil (Pete Grant)
Newsgroups: comp.lang.c++
Subject: Re: BC++ 3.0 TDW and Windows 3.1
Date: 7 Oct 92 18:30:54 GMT
Organization: U.S. Army Artificial Intelligence Center, The Pentagon

In article <tpenttin.718029822@majakka.uku.fi> tpenttin@majakka.uku.fi (Tommi Penttinen) writes:
>"Can't load WINDEBUG.DLL". That's what my TDW tells me when I try to debug
>anything.. And I'v put WINDEBUG.DLL on the dos command path as told in a

This is a known bug.  I called Borland and got a new windebug.dll.  I
don't know if they'll do the same for you, being so far away.  

Pete.

.... Responding via usenet in case others have the same problem ...
Newsgroups: comp.lang.c++
From: swillden@news.ccutah.edu (Shawn Willden)
Subject: Re: streams
Organization: University of Utah Computer Center
X-Newsreader: Tin 1.1 PL3
Date: Wed, 14 Oct 92 00:51:35 GMT

mdk34398@uxa.cso.uiuc.edu (Mike Krupicka) writes:
: I am writing some code where I would like to be able to read in either from
: stdin or from a file. What I want to know is how do you initialize the stream,
: and pass it to a common var. I tried something like the following and had
: problems because the code was local only to the if statement.
: 
: main(){
: .
: .
: if (stdflag)
: 	ostream& fin = cin;
: else
: 	ofstream& fin("test.in");
: 
: Any ideas?

Try :

main(){
Newsgroups: comp.lang.c++
From: svihura@enel.ucalgary.ca (Mike Svihura)
Subject: Public domain Class Browsers
Summary: Need C++ browser 
Date: Tue, 13 Oct 92 22:33:50 GMT
Reply-To: svihura@enel.UCalgary.CA (Mike Svihura)
Organization: Electrical Engineering, U of C, Calgary, Alberta, Canada
Keywords: tools, C++

	I was wondering if anyone has heard of -- or has in their
possesion -- a general purpose browser for C++ classes. This browser
should have the following features:

	1) Display class hierarchies, including multiple inheritance.
	   Display should include data and member functions.

	2) Preferably an X-windows interface.

	3) Public Domain (i.e. Free)

If anybody has heard of such an animal, I would appreciate hearing
about it.

		Thanks in Advance
		Mike Svihura

-- 

----------------------------
Mike Svihura
svihura@enel.UCalgary.CA
Newsgroups: comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: vsprintf vs. incore-formating: philosophy
Organization: TauMetric Corporation
Date: Thu, 8 Oct 1992 16:11:42 GMT

ric@updike.sri.com (Richard Steinberger) writes:


>	Can anyone provide some advice on whether to use vsprintf() in 
>a C++ program?  This C library function is not overloadable/extensible,
>but it does exactly what I need done with standard data types.  Do people
>generally feel that it is worth the effort to develop a similar 
>function using incore formatting and thus follow "the spirit of C++"?

The function is part of the Standard C library, and is thus part of C++.
In that respect it is perfectly legal.

However, the printf (and scanf) family of functions are inherently
unsafe: They take variable argument lists, and have unchecked type
dependencies between the format string and the actual arguments.
These functions are contrary to the "spirit of C++", which
involves type safety, among other things.

If you want to use vsprintf, do so.  If you want the advantages of
C++ type checking and extensibility, don't use it.  You can use
iostreams to do almost anything you can do with printf/scanf.

In particular, you can use strstreams to get safe in-memory
formatting.  One concern with sprintf is overflowing the target
buffer.  This needn't happen with strstreams, apart from the
type-safety and user-extensibility advantages.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
From: dg@otter.hpl.hp.com (Dipankar Gupta)
Date: Fri, 16 Oct 1992 10:31:34 GMT
Subject: Re: Standard for Class Information?
Organization: Hewlett-Packard Laboratories, Bristol, UK.
Newsgroups: comp.lang.c++


In article <djd.719140842@reading> djd@csug.cs.rdg.ac.uk writes:
>I was sitting here thinking how class browsers might work, and wondered
>if C++ compilers should be able to produce a file containing class
>descriptions according to a _standard_ format.  This would remove the
>necessity for class browsers to be able to parse C++ code, and be
>completely decoupled from dialect and compiler.
>
>Does anyone know of any proposals in this vein?

Is there any move to define AST (abstract syntax tree) classes? DEC SRC's
Modula-3 provides these as part of the toolkit, and they are extremely useful 
for writing things like browsers, and other programs that manipulate source
code.

Dipankar
dg@hplb.hpl.hp.com
From: Lewis.G..Pringle@f1.n100.z60.wlink.nl (Lewis G. Pringle)
Newsgroups: comp.lang.c++
Subject: ios::iword, ios::pword, ios::xalloc
Date: Mon, 12 Oct 1992 20:14:26 -0100

Organization: Sophist Solutions

In article <1992Oct8.234902.12170@lucid.com> jss@lucid.com (Jerry Schwarz) writes:
>These functions are intended to support extension of stream types
>without requiring derivation.  My claim is that this is useful because
>the actual type of a stream is lost in an expression involving insertions
>or extractions.  That is
>
>	mystream m ;
>	m << y << mymanipulator ;
>
>You can't declare
>
>	mystream& mymanipulator(mystream&) ;
>
>because it's argument is an ostream&, not a mystream&.  However mymanipulator
>can look into the infinite arrays  for any useful information put there
>by the mystream constructor.

Could you please elaborate even further.

A long standing problem with the isotream library, from my point of view,
was that roughly half the time I wanted the interpretation of inserters
to be that it inserted a "pretty" form of the item, and the other half
of the time I wanted the interpretation to be to insert an EXTRACTABLE
represenation of the item. This "pretty" form is most often useful when
preparing to display some object, or when writting out debug info. The
EXTRACTABLE version is most useful when saving and restoring to a file.

I've experimented with hacks like global variables, etc, but what I really
wanted was the ability to "add a boolean" into the iostream so that each
inserter could write things out appropriately. Ideally I would want the
predefiend inserters and extractors (eg int) to also pay attention to
this boolean.

Could the iword/pword mechanism be used to achieve this? Do you know of
some better mechanism to achieve this? How are you supposed to actually
use the iword/pword mechanism? Where is it documented?

			Lewis.
-- 
Reading peoples signatures is a real waste of time.

lewis@sophists.com                                  (Lewis Gordon Pringle, Jr.)

Newsgroups: comp.lang.c++
From: jss@lucid.com (Jerry Schwarz)
Subject: Re: help about fstream needed!
Reply-To: jss@lucid.com (Jerry Schwarz)
Organization: Lucid, Inc.
Date: Tue, 13 Oct 92 23:04:13 GMT

In article <1b8797INNp6c@function.mps.ohio-state.edu>, ren@function.mps.ohio-state.edu (Liming Ren) writes:
|> I write a short prgram to define a class X and try to write it to a file.
|> I get error messages when  I complile it. Could somebody nice to tell me what 
|> is wrong and how to correct it?
> 
...

|> write(fstream st, X& a, streampos p)

The problem is here.  "st" must be passed by reference rather than
by value.  The proper definition would be

	write(fstream& st, X&, a, streampos p)

Streams are "reference classes" they cannot be passed around by value.
In order to ensure that this doesn't happen by accident, the copy
constructor is declared private. This seemed to have caused a whole
cascade of complaints about private members in your case.

Since "write" does only generic ostream operations
it would work just a well to declare 

	write(ostream& st, X& a, streampos p) 


  -- Jerry Schwarz
Newsgroups: comp.lang.c++
From: robert@charon.jpl.nasa.gov (Robert Angelino)
Subject: What's the status on a standard on this language??
Reply-To: robert@triton.Jpl.Nasa.Gov
Organization: Jet Propulsion Laboratory, Pasadena CA
Date: Mon, 12 Oct 1992 18:54:02 GMT

Hello,
	I'm interested in knowing if IEEE or ANSI or some org. has developed
an industry accepted standard???  How close is it??  How far is it??
Will there ever be one???  Is one already here and I've lived in a cave
for the last three years???

thanks!!

-robert
Newsgroups: comp.lang.c++
From: kanze@us-es.sel.de (James Kanze)
Subject: Re: Persistance Problem Solved by Memory-Mapped Files?
Organization: SEL
Date: 7 Oct 92 18:23:20

In article <rmartin.717814628@thor> rmartin@thor.Rational.COM (Bob
Martin) writes:

> feustel@netcom.com (David Feustel) writes:

> |I'm wondering whether the problem of persistant objects could be
> |solved by use of memory-mapped files to store the C++ data structures
> |used by C++ programs. Comments?

> I know someone who has cooked up some classes which use mapped files
> to provide some persistence.  In his model, you derive your classes
> from the persistent class.  The persitent base class provides all the
> member functions for mapping the object to the file.

> Pointers are problematic.  As long as every application maps the file
> into the same address space, then persistent pointers to persistent
> objects may be sharable between processes.  If the mapped file is
> being shared between two processes, it is important that the
> persistent objects not internalize any pointers to local
> (non-persistent) objects.

From the point of view of persistence (or transportability, which
involves many of the same problems), there are two distinct types of
pointers to be considered.

The first class of pointers are those that are used purely to build up
a complete representation of the class.  (An example would be a
pointer to a string of characters.)  These pointers do not really
create a problem; you save/transport what they point to.

The second type of pointers point from one object to another, and
serve to build relationships.  The only solution I know of for these
types of pointers is to name the objects, create a dictionary, and
save/transport the objects with their name, replacing such pointers
with the name of the object pointed to.
--
James Kanze                         GABI Software, Sarl
email: kanze@us-es.sel.de           8 rue du Faisan
                                    67000 Strasbourg
                                    France

Newsgroups: comp.lang.c++
From: lbin@sierra.com (Li Bin)
Subject: ATT Task library run-time error
Organization: Sierra Geophysics Inc.,  Kirkland, Wa
Date: Fri, 9 Oct 1992 20:47:05 GMT


Hi, everybody

I am trying to use the task library from AT & T on our HP9000/750 machine.
No matter how simple my testing program is, I always get same run-time
error:

***** task_error(27) FrameLayout::FrameLayout(): frame size
Bus error (core dumped)

	According to error message, it seems the task system cannot determine
the stack frame size.

Can anyone help me with this problem ? I really appreciate very much.

Thanks.

LiBin

-- 
--------DISCLAIMER: ANY OPITIONS EXPRESSED HERE ARE NOT SIERRA'S--------
Li Bin                             |    3D Visualization Group
E-mail: lbin@sierra.com            |    Sierra Geophysics, Inc.      
Voice:  (206)822-5200              |    Seattle, WA 98124-3886 
Newsgroups: comp.lang.c++
From: zoo@cygnus.com (david d 'zoo' zuhn)
Subject: Re: C++ for Sparcs: recommendations?
Organization: Cygnus Support -- +1 415 322 3811
Date: Thu, 8 Oct 1992 07:10:59 GMT


   >I wasn't aware that there was a "Xerox" standard for C++.

	   viz., cfront, version 3.0

Since when is cfront from Xerox?


	   It is my understanding that this is expensive,
	   and besides, isn't cfront just a C++ to C 
	   translator, rather than a true compiler?

Well then, aren't most C compilers just C to assembly translators?  It does
enough work to call it a compiler in my book.

	   I have. I used g++ all of last year.  Gave up
	   on it before the new version came out this year,
	   but I understand that that was only a bug fix anyway.
	   It (g++) had some nice features, but I would rather
	   have something solid that is well supported, has
	   a nice development environment.  If it
	   keeps up with new developments in the language,
	   that is a plus, also.  Gnu (although I think gnu's C
	   is great and fast from what my friends say) fails on
	   all of these points, or at least it did last year 
	   when I was entrenched in it - although to my knowledge
	   nothing has changed enough to make me go back to it.
	   Free is not a great deal when it wastes my time,
	   which to me is quite valuable.

Well, g++ is getting better all of the time.  It is significantly better in
the 2.x releases than in the 1.x releases.  I know of several people
compiling a million lines of C++ code with g++.  I know of many more doing
100,000 lines of C++ with g++.  It's a good compiler.

If you want support, you can get support from a wide variety of places,
since you've got the source code.  

Might I suggest that you take another look at g++.

  david d 'zoo' zuhn |    The problem with politics is that it puts you in
    cygnus support   |    contact with the sort of people that you'd really
    zoo@cygnus.com   |    rather try to avoid.
From: vincent@datmuc.UUCP (vincent)
Newsgroups: comp.lang.c++
Subject: Re: static reference
Date: 8 Oct 92 13:35:17 GMT
Organization: DAT

In article <718427363snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk (Nikki Locke) writes:
 >
 >In article <1310@datmuc.UUCP> vincent@datmuc.UUCP (vincent) writes:
 >
 >> 
 >> class a {
 >> 	static a *sap;
 >> 	static a &sar;
 >> public:
 >> //	a () { if (sar == 0) init_stuff };
 >What is the meaning of "(sar == 0)" ?
 >
 >If you wrote ...
 >a foo;
 >
 >if(foo == 0)
 >What would that mean ? 
 >> };
 >> 
 >> a *a::sap;
 >> a &a::sar;
 >> 
 >> 
 >> Ok what of that?
 >> 
 >> MC cl complains about 'sar' having to refere to something. Fine I want it
 >> initialize to zero. 
 >A reference is unlike a pointer in two respects.
 >1) A reference ALWAYS refers to the same object. You can use a pointer to 
 >point to one object, then later point to another one.
 >2) A pointer can point to nothing at all (pointer == 0), a reference 
 >cannot.
 >
 >> I had a list of stuff with a static head pointer, It works fine but after
 >> reading 'Effective C++' I started to use reference more and more.
 >Unless your head pointer always points to the same object (i.e. you have a
 >list/tree/whatever whose first element is always the same), you can't use 
 >a reference.
 >---
 
Thats what I want I have a head of list, it changes only once from NULL
to a pointed object. When It's back to NULL the list is destroyed.

Ya Ok I get it, reference are only another name for ... .

I got a bit confused 'cause they seam to be a lot like pointers.

ciao vincent@datmuc.dat.de