HDTenEightyP/NetNews huggingface dataset:
From: mittle@siena.watson.ibm.com (Josh Mittleman)
Subject: Re: Const and Reference
Date: Fri, 09 Oct 92 14:32:14 GMT
Organization: IBM T. J. Watson Research

In my earlier posting on this subject, I made a mistake, which a couple
people caught.  I wrote:

4> char a = '-';
5> const char &b = a;    // error: asignment to constant
6> 
7> b = '+';

Line 5 is correct; line 7 is the error, an assignment to const.

However, Shih-Hao Liu corrected his original question:

> #include <stdio.h>
> main()
> {
>   char a = '-';
>   const char &b = a;
> 
>   a = '+';
>   printf("%c\n", b);
> }

The correct output is '+'.  A reference is an alias, so any change to a is
also a change to b.  

Sekar quoted ARM:

> Also ARM p. 154 says, "... if the reference is to a const an object
> of type will be created and initialized with the initializer."
> Hence, if you modify variable a above it would not get reflected
> in reference b.

No, you are mis-reading the text: It refers to a reference to a const, not
a const reference.  The examples which follow illustrate the point:

  double d = 1.0;          // normal initialization
  double& rd = d;          // rd refers to d
  const double& rcd = d;   // rcd refers to d
  
  double& rd2 = 1;         // error: type mismatch.
  const double& rcd2 = 1;  // rcd2 refers to a temporary initialized with
                           // the value 1.

An analogous situation in the context of the original problem would be:

#include <stdio.h>
main()
{
  const char a = '-'
  char &b = a;              // warning: const initializer: temporary used to
                            // initialize reference 
  b = '+';                  // temporary is changed; change does not
                            // propogate to a. 
  printf("%c %c\n", a, b);  // output: - +
}

A non-const reference to a const object forces the creation of a temporary,
and any assignment to the reference changes the temporary, not the original
const.

===========================================================================
Josh Mittleman (mittle@watson.ibm.com)
J2-C28 T.J. Watson Research Center, PO Box 704, Yorktown Heights, NY  10598
Newsgroups: comp.lang.c++
From: pkoch@news.weeg.uiowa.edu (Peter F Koch)
Subject: Please Send: Info on DB++ from Qualix
Organization: University of Iowa, Iowa City, IA, USA
Distribution: usa
Date: Thu, 8 Oct 1992 16:56:40 GMT

To the person who sent me information on DB++ from Qualix: Could
you please e-mail the information on your product again.  I 
accidentally deleted it. Thanks
Newsgroups: comp.lang.c++
From: halter@rchland.vnet.ibm.com (Steven Halter)
Subject: Re: Persistance Problem Solved by Memory-Mapped Files?
Date: Fri, 09 Oct 1992 13:59:34 GMT
Reply-To: halter@rchland.vnet.ibm.com
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
Organization: IBM Rochester

The IBM AS/400 has an operating system particularly amenable to this kind of problem.
The OS is based on the concept of the single level store. The single level store
provides one large persistent shared virtual address space over the entire system. 
A given process may request objects (files, devices, spaces, etc.) to be created in
the single level store. Once an object is created its virtual address is persistent
and may be shared between all processes on the system. This means that you can create
a bunch of objects that contain pointers among themselves, turn the system off, turn
it back on and the objects and their pointers will still be there and still be valid. 
 
-- 


- Steven L. Halter  IBM Rochester, MN
  Network Address: RCHLAND(HALTER) 
  Internet: halter@rchland.vnet.ibm.com
Newsgroups: comp.lang.c++
From: kanze@us-es.sel.de (James Kanze)
Subject: Re: yacc in c++?
Organization: SEL
	<CARNEY.92Sep29085216@rocky.rational>
	<1992Sep30.123933.11424@stiatl.salestech.com>
Date: 7 Oct 92 18:08:16

In article <1992Sep30.123933.11424@stiatl.salestech.com>
ges@stiatl.salestech.com (Gerald Sullivan) writes:


> carney@rocky.rational (Mike Carney) writes:

> >Not it the version of yacc that I have (SunOS 4.1.2). The output from
> >this is K&R C, which will not compile with a C++ compiler. Therefore,
> >I cannot have (with my version of yacc) C++ actions in my grammar. In
> >fact, I've only seen third party products, and a special version of
> >yacc from Sun called yacc++, which work properly with C++ code.

> It is easy to get any yacc to work with C++. All you have to do is make the
> output C++ compatable. You can do this by modifying the parser and lexer
> template files so that the will compile under C++. I assume all yaccs
> have these files hidden somwhere.

Unless you're super-user, you typically don't have access rights to
modify these files.

There's no reason to let that stop you, though.  I've had no problems
with putting the appropriate function prototypes in the header (before
the first %%), and running the output through a shell script to
automatically edit a few odds and ends.

The real pain is that the %union (in yacc) cannot contain class
objects.  The best I've been able to do is to have it contain pointers
to class objects allocated off the heap.  This requires some care as
to when you free the memory if you don't want to have memory leaks.

All in all, however, I regularly use both the MKS lex and yacc and the
Unix versions with C++, and have not had any problems.
--
James Kanze                         GABI Software, Sarl
email: kanze@us-es.sel.de           8 rue du Faisan
                                    67000 Strasbourg
                                    France
From: pickerig@dns0.bham.ac.uk (Mr. G. Pickering)
Newsgroups: comp.lang.c++
Subject: Re: C++ Compiler for Mac.
Date: 15 Oct 92 14:40:54 GMT
Organization: The University of Birmingham, England
X-Newsreader: TIN [version 1.1 PL6]

> Can anyone tell me if there is a Borland compatable C++ compiler
> for the Macintosh?  I have written a program using Turbo C++, and
> I would like to run it on the Mac without having to do a whole
> bunch of re-coding.
 
What does "Borland Compatible" mean? Do you want a compiler that supports
the C++ language as defined by ARM, or would you like one that supports
any non-standard features of the Borland compiler.

Sorry for the sarcy comment.

If you do not get a reply about a product available on the Mac, there is
one solution if all you want to do is a straight port:

If you have access to CFRONT, you can use CFRONT purely as a translator
to produce C code. This C code can then be compiled on the Mac using
a normal C compiler.

This solution isn't great, but if there is no other way...


Guy.


--
Guy Pickering
Electronic Eng, University of Birmingham, Edgbaston, Birmingham. ENGLAND
G.PICKERING@uk.ac.bham  or pickering@uk.ac.bham.eee
Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Proposal: Preconditions and PostConditions in C++
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Sun, 11 Oct 1992 13:10:00 GMT

In article <Bvq8tF.J3C@fiu.edu> feathers@serss0 (Michael Feathers) writes:
>I advance this idea with some trepidation... (ooh! noo! new language 
>feature!) but has anyone considered adding Eiffel-style pre and post 
>conditions to C++?

	Yes. See "The Behaviour of C++ Classes", Marshall Cline
and Doug Lea, which describes a comprehensive assertion system
(better than Eiffels IMHO) called A++.

(I think you can FTP the article from sun.soe.clarkson.edu)

>
>I once read an article by Bertrand Meyer in which he explained "contractual
>programming" in Eiffel.  Each feature (henceforth called functions here)
>could list a set of conditions which would have to be met before the body of
>the function could be performed, and a set of conditions which should be
>met before the function returned to its caller.  Failure to meet the 
>conditions could be monitored in a debugger or tied to the exception
>handling mechanism of C++.
> 
>The advantages of such a style of programming are numerous.  Foremost,
>among them is the fact that placing these conditions in source is a good 
>form of documentation.  The conditions under which a function is supposed
>to work are immmediately obvious to readers of the source.  However, if
>that was the only advantage, comments could be used.  The fact that conditions
>could carry some weight... or be selectively enforced, would be useful.
>I've read that Eiffel code often becomes cleaner with these conditions 
>because they render many of the other checks in code redundant.  

	I liked A++ so much I am now writing a preprocessor for C++
that will support it (or something similar) as documentation.
If that works well, I might put the assertions in (optionally)
as run-time checks. The original aim of A++ was then to
optimise these out with automatic reasoning technology, but I believe
that it proved too hard to reason about C++.

>
>It seems to me that this feature would be extremely useful for writing safety
>critical code and it would not incur any expense if it were not used.  As 
>with all other good features of C++, it could be completely optional.
> 
>If anyone knows whether this has been proposed before, or any reason why it
>can not or should not be, please reply.
> 
> 

	There is at least one other system, the status of which I
do not know.


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
From: pluto@cs.ucsd.edu (Mark Plutowksi)
Newsgroups: comp.lang.c++
Subject: Re: ProtoGen is worthless?!?
Date: 10 Oct 92 17:36:00 GMT

joec@cybernet.cse.fau.edu (joseph cossette) writes:

>myhre@plains.NoDak.edu (Robert Myhre) writes:

>> 
>>   HI all.  I recently purchased BC++ 3.1 and it includes a free copy of
>> Protogen.  However, from what I have seen from the initial reading the
>> Resource Workshop already does what Protogen does.  Further, Protogen
>> requires Resource Workshop for creating the menus, dlg, etc.  Can anyone
>> tell me what the real use of Protogen is?  I must have missed it!  :)
>> 

>You're lucky, you got it for free! I paid $50 for it, and the week after 
>I got it they gave it away! I agree it's worthless.


First of all, Resource Workshop is included with BC++ w/ App Frameworks.
You lay down your dialog boxes, menues, & other windows resources
with it, and THEN you use Protogen to generate the source linking
these resources with the rest of your app.  Once generated you
modify the generated source to call your functions and to finetune
the operation of the gui interface (Protogen doesn't do everything.)

Protogen generates the main windows function and classes for each of the
dialog boxes, and message response functions for each of the controls.
You fill in the rest.

Myself, I would not have been able to write a true Windows app without it.
Hence, it made the "Application Freameworks" part of BC++ worth having,
as writing the windows code scratch would have been a bear.

= Mark
Newsgroups: comp.lang.c++
From: lalford@fsu1.cc.fsu.edu (LYNN ALFORD)
Subject: Re: Question for Borland c++ experts
News-Software: VAX/VMS VNEWS 1.3-4   
Reply-To: lalford@fsu1.cc.fsu.edu
Organization: Florida State University
Distribution:  world
Date: 12 OCT 92 15:40:13    

In article <1992Oct12.175723.25314@mailer.cc.fsu.edu>, lalford@fsu1.cc.fsu.edu (LYNN ALFORD) writes...
>the DPMI part.  I just want to be able to play with the system for a bit 
>on a Toshiba T1000xe with 8086 processor.  It has the 640 K of conventional 
>memory needed, but will 1 megabyte of expanded memory allow the DPMI to 

The answer is no, it just won't work on a 8086.  Ah well, worth a try.

Lynn
Newsgroups: comp.lang.c++
From: crlstu4@bnr.ca (Goetz von Escher)
Subject: Re: Is pointer in my address space?
Keywords: address space memory pointer
Organization: Bell-Northern Research, Ottawa, Ontario, CANADA
Date: Fri, 9 Oct 92 23:06:08 GMT


In article <1992Oct9.160154.2427@bnr.ca> crlstu4@bnr.ca I wrote:

>   Is there a way to find out if a pointer is a valid pointer in C/C++?
>   Or in other words: If I want to read a value in memory, how do I
>   know wether I can read the value at this address without causing
>   an exception (bus error, segmentation fault and that stuff)?


OK! YOU ASKED FOR IT! I tried to make it short and simple, but it seems you
missed the point. I do not want your comment wether I should do this or
not (because I'm doing it anyway if I can find out how...). What I need are
clues, hints, solutions, tips, tricks, enlightenings, ideas... -:)

To justify my demand: I can think of at least three problems, where it
would be very useful to test a pointer before reading the memory it
points to:

[1] When you write a debugger

[2] When pointers come from outside the program ->user input

[3] In the problem I'm actually dealing with:

I am writing an error handling module within a software project.
In case of a serious error we want to save the user data if possible. The
data consists out of objects connected together by pointers. Now before
I follow a pointer to test wether the data at this memory address *could*
be an object, I have to make sure that I can read the memory address.
Otherwise I get an exception in my error handling, which will basically
trigger the error handling again...

Doesn't sound very odd to me!
Goetz

 

Newsgroups: comp.lang.c++
From: ckw@Cookie.secapl.com (Kirk Woerner)
Subject: Simple Bor 3.1 Object inheritance question
Date: Sat, 10 Oct 1992 20:51:00 GMT
Distribution: usa
Organization: Security APL, Inc.

Hello I've got a very simple problem.  I'm learning the Borland class
library and I want to create a class TPoint that holds an X and Y point.  I
thought the idea for this would be to inherit the class from Object and
declare all the pure virtual functions and the thing should work.  Below is
what seems to be almost the minimal amount of stuff a new class HAS to have
in order to be a valid Object in the library.  Forgetting the obvious ANSI C
violations in main(), the program will not link because of an "undefined
symbol Object::zero". I don't understand and have been looking for a while.
I know it is probably a stupid mistake but can anyone with more experience
with the object lib out there help me?

#include <object.h>
_CLASSDEF(TPoint)
class TPoint: public Object
{
public:
int X,Y;

TPoint(int Ax, int Ay) {X=Ax; Y=Ay;}
virtual classType isA() const { return __firstUserClass+1; }
virtual char *nameOf() const { return "TPoint"; }
virtual hashValueType hashValue() const  { return 0; }
virtual int isEqual(const Object&) const { return 0; }
virtual void printOn(ostream&) const {return;}
}

main()
{
TPoint Point(2,3);
}
-- 
                          "It's INCONCEIVABLE !!!!"
          "I do not think that word means what you think it means."
                                          --- from "Princess Bride"
Newsgroups: comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: static member and access control?
Organization: TauMetric Corporation
Date: Wed, 7 Oct 1992 15:21:17 GMT

[ someone ] writes:

>From article <1992Oct5.125039.16602@news.uni-stuttgart.de>...
>>  ...
>> The question now is: is the initialization illegal or not.
> ...
>Borland 3.1 complains with an error ...

This kind of answer isn't really very helpful.  The original poster
was asking about a language rule.  The answer is in the ARM, and
has already been posted.  (I've elminated names because I don't
want to pick on one individual, but rather make a general plea.)

The fact that compiler X does or does not like the construct is not
an answer to the original question.  In fact, the original question
arose because one compiler reported an error and another did not.

I'd like to discourage the practice of asking the compiler about
language rules, particularly in this forum.  The C++ language
has been evolving, and continues to evolve.  Different compilers
have been written to different versions of the language, and all
compilers have bugs.  (For example, BC++ got this particular
question wrong, although it gets most things right.)

There are legitimate reasons for surveying compilers, but when a
language rule is at issue, let's check the language manual first.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Xref: sparky comp.lang.c++:14845 comp.std.c++:1370
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c++,comp.std.c++
Subject: Re: NIHCL C++ class library and X11's libXt both use Object
Date: 11 Oct 92 13:27:53 GMT
Article-I.D.: alice.23859
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Murray Hill NJ

In article <1992Oct10.210145.12634@muddcs.claremont.edu> jason@jarthur.claremont.edu (Jason Merrill) writes:

> But then, suppose you're only using the NIHCL, and you don't really feel
> like typing NIHCL:: every time you want to use one of its classes.  I think
> that a 'with' directive, as per Ada, would be useful here...

Well, maybe.  Such things have a potential problem.  Suppose you have
something like this:

	int count = 0;

	void foo()
	{
		count++;
		// ...
	}

Suppose also that foo uses things from some library, which it brings into
its namespace with something like Ada's 'with' directive.

That means that if a future version of the library acquires a component
named "count," it will conflict with the global one, either by hiding it
or by causing an ambiguity.  Either way, the purpose of the feature has
not been fulfilled.

For that reason, I think it is much more important in general to be able
to import specific names than to import a namespace wholesale.  The latter
might be handy sometimes, but it is essentially always hazardous.
-- 
				--Andrew Koenig
				  ark@europa.att.com
From: matt@centerline.com (Matt Landau)
Newsgroups: comp.lang.c++
Subject: Re: C++ for Sparcs: recommendations?
Date: 7 Oct 1992 21:36:22 GMT
Organization: CenterLine Software, Inc.
NNTP-Posting-Host: 140.239.1.32

In <1992Oct7.142227.23905@sdc.com> emike@sdc.com (E. Mike Durbin) writes:

>  >	- has gui-building capabilities ala BC++'s OWL & Protogen,
>  >	  but for X Windows instead.

>There are lots of C++ based gui buildes, and even more C based gui
>builders.  Some, such as Objectcenter and (presumably) ParcPlace
>(both of which supply the Solbourne C++ toolkit and GUI builder)
>provide compilers, debugger, browsers, etc., as well.  (I use and
>VERY MUCH like the Solbourne C++ toolkit).

Gee, thanks for the kind words about our products, but I have to make
a slight correction or two.

    ViewCenter (not ObjectCenter) is our GUI builder product.  It
    includes the OI class library for creating OPEN LOOK and Motif
    interfaces using C++ classes for the GUI objects, and includes
    the interactive user interface builder.  ViewCenter is what you
    want to use instead of some C-language widget-based toolkit :-)

    ObjectCenter (not ViewCenter) is our C++ programming environment.
    It's based on a C++ interpreter and incremental linker, does a
    lot of runtime error detection that other debuggers and development
    tools cannot do, and has a wide variety of graphical browsers for 
    inspecting aspects of your code either statically or while the 
    program is running.  ObjectCenter is what you want to use instead
    of SparcWorks C++ :-)

Seriously, I'm not trying to do marketing here, since that's not what
technical newsgroups are for.  But I did want to clear up confusion about
which product was which.  Back to hacking now ...
--
 Matt Landau			     Waiting for a flash of enlightenment
 User Interface Architect/Engineer	in all this blood and thunder
 matt@centerline.com
From: robison1@husc10.harvard.edu (Keith Robison)
Newsgroups: comp.lang.c++
Subject: Problem installing libg++
Date: 8 Oct 92 23:47:04 GMT
Article-I.D.: husc10.robison1.718588024


	If someone can help me with this, I would be very grateful.
I have tried to install g++ 2.2.2 on my SPARCstation and got the
gcc/g++ to install but not libg++ 2.2. 

/usr/big/robison/gnu/libg++-2.2/gcc/gcc -B/usr/big/robison/gnu/libg++-2.2/gcc/ -g -nostdinc++ -I.. -I. -I./../iostream -I./../g++-include -I/usr/big/robison/gnu/libg++-2.2/libg++/../gcc/include -c String.cc
In file included from ./../iostream/iostream.h:25, from ./../iostream/stream.h:7, from ./String.h:26, from String.cc:25:
./../iostream/streambuf.h:38: parse error before `ostream'
*** Error code 1
make: Fatal error: Command failed for target `String.o'
Current working directory /usr/big/robison/gnu/libg++-2.2/libg++/src
*** Error code 1
make: Fatal error: Command failed for target `in-src'
Current working directory /usr/big/robison/gnu/libg++-2.2/libg++
*** Error code 1
make: Fatal error: Command failed for target `all-libg++'


#ifndef _STREAMBUF_H
#define _STREAMBUF_H
#ifdef __GNUG__
#pragma interface
#endif

#include <_G_config.h>
#ifdef _G_NEED_STDARG_H
#include <stdarg.h>
#endif
#ifndef fpos_t
#define fpos_t _G_fpos_t
#endif

#ifndef EOF
#define EOF (-1)
#endif
#ifndef NULL
#define NULL ((void*)0)
#endif

class ostream; class streambuf; class backupbuf;    <<<< line 38

	

Thanks to anyone who can help!

Keith Robison
Harvard University
Department of Cellular and Developmental Biology
Department of Genetics / HHMI

robison@ribo.harvard.edu
Newsgroups: comp.lang.c++
From: rbb@cs.brown.edu (Robert Baynes)
Subject: RPCGEN and C++
Keywords: client,server, c++, rpcgen, c
Organization: Brown Computer Science Dept.
Date: Thu, 8 Oct 1992 13:19:46 GMT

We are writing a rather large distributed system using C++. We  
are now generating our own xdr stuff (using rpcgen) for the 
clients and servers. All of this code is generated in C. Does
anyone know of something similar to rpcgen that would produce
the client, server and xdr code in C++? 






-- 
*******************************************************************************
	Bob Baynes		Department Of Computer Science
	rbb@cs.brown.edu	Box 1910, 115 Waterman Street
	(401)863-7684		Brown University
				Providence, RI 02912
*******************************************************************************
From: ANDREW@odin.uniras.dk (Leif Andrew Rump, Software Engineer, UNIRAS A/S)
Newsgroups: comp.lang.c++
Subject: Re: virtual destructors
Date: 15 Oct 1992 05:06:03 -0500
Organization: UTexas Mail-to-News Gateway
NNTP-Posting-Host: cs.utexas.edu

cshaver@informix.com (Craig Shaver) writes:
>In article <1992Oct12.164043.18038@aplcen.apl.jhu.edu> ded@aplcen.apl.jhu.edu (nod sivad) writes:
>>
>>Thanks to everyone who responded to my problem concerning the need
>>to call the destructors of derived objects with a base class 
>>pointer.  I said in my message what I really needed was a virtual
>>destructor.
>>
>>The answer to my problem is...declare a virtual destructor.  Duh.
>>
>
>C++ is complex enough to be self destructive :)

	A recent saying has it that while C++
	make is pretty difficult to shoot yourself
	in the foot (in contrast to C), when it
	does happen, it blows your whole leg off!
	(Sorry I forgot the author)

>ded@aplcen.apl.jhu.edu (nod sivad) also writes:
>>Now I wonder what other interesting uses one can make of "virtual." A whole 
>>new world has opened for me; perhaps I've stumbled upon virtual reality.

You may have a interesting point there!

Andrew

Leif Andrew Rump, UNIRAS A/S, 376, Gladsaxevej, DK-2860 Soeborg, Denmark
UUCP: andrew@odin.uniras.dk, Phone: +45 31 67 22 88, Fax: +45 31 67 60 45

Plan:
begin 644 plan
M5&AI<R!S<&%C92!I<R!U;FEN=&5N=&EO;F%L;'D@8F5E;B!L969T(&)L86YK
K+BXN"@H)"0D)"4%N9')E=PHH0V]P>7)I9VAT("AC*2!$;W5G(#$Y.3(I"FYK
 
end

Newsgroups: comp.lang.c++
From: nikki@trmphrst.demon.co.uk (Nikki Locke)