HDTenEightyP/NetNews huggingface dataset:
From: carney@rocky.rational (Mike Carney)
Newsgroups: comp.lang.c++
Subject: Re: yacc in c++?
Date: 29 Sep 92 15:52:16 GMT
Distribution: usa
Organization: Rational, Santa Clara, CA
In-reply-to: pjl@sparc10.cs.uiuc.edu's message of 29 Sep 92 01:18:45 GMT


In article <1992Sep29.011845.3409@sunb10.cs.uiuc.edu> pjl@sparc10.cs.uiuc.edu (Paul Lucas) writes:
   In <BvB5oD.4FD@cs.columbia.edu> igor@cs.columbia.edu (Igor Pankevich) writes:

   >I am a student (forgive me if this is a FAQ, I couldn't find the
   >answer at my site.)  I need to write a yacc grammar that will work
   >with my c++ program.  Where can I find a version of yacc to do this?

   *****>	Standard yacc works with C++; you just have to write your own
	   .y.c (or .y.o) rule to replace the "extern char *malloc()" line
	   with "#include <stdlib.h>"

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.

--

                                |     |                         
    Michael D. Carney           \\_V_//
    email: carney@rational.com  \/=|=\/   
    phone: 408-496-3790          [=v=]     
                               __\___/_____
                              /..[  _____  ]
                             /_  [ [  M /] ]   
                            /../.[ [ M /@] ]            
                           <-->[_[ [M /@/] ]  
                          /../ [.[ [ /@/ ] ] 
     _________________]\ /__/  [_[ [/@/ C] ]
    <_________________=>>0--]  [=\ \@/ C / /                           
                      ]/000o   /__\ \ C / /           
                              /....\ \_/ /                      
                              [___/=\___/ 
                              [...] [...]
    "Remember...No matter     [___/ \___]
     where you go, there      <---> <--->
     you are."                [..]   [..]
                             _[__]   [__]_
                            [____>   <____]
                                      






Newsgroups: comp.lang.c++
From: feustel@netcom.com (David Feustel)
Subject: Persistance Problem Solved by Memory-Mapped Files?
Date: Tue, 29 Sep 92 02:03:09 GMT
Organization: DAFCO: OS/2 Software Support & Consulting

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?
-- 
Dave Feustel N9MYI <feustel@netcom.com>
 
[.sig on vacation]
From: vincent@datmuc.UUCP (vincent)
Newsgroups: comp.lang.c++
Subject: Scott Meyers
Date: 6 Oct 92 14:46:15 GMT

Hello anybody has his Email, I have a question about Item 8 of his book.
 
Newsgroups: comp.lang.c++
From: sullivan@teal.csn.org (Steve Sullivan)
Subject: Template trouble in gnu c++ with func def
Organization: Colorado SuperNet, Inc.
Distribution: na
Date: Wed, 30 Sep 1992 03:09:45 GMT



It appears that the function definition:
   template<type> func() {...}
is not handled correctly by g++.

The following short program doesn't compile under g++ (gcc) 2.2.2
on a Sparc 2, SunOs 4.1.  Yet it seems to me it should.
Is there a fix for this?

Many thanks -

Steve Sullivan
sullivan@csn.org

===== begin program =================
template <class T>
class QI {
public:
  QI();
  void print();
private:
  T item;
  QI *next;
  };



template <class T>
QI<T>::QI() {}


template <class T>
void QI<T>::print();

// **** following line is line 21, and causes error:
QI<int> afunc() {
   QI<int> alpha;
   return alpha;
   }

main () {
   QI<int> beta;
   }
=============== end program ===================

diagnostics printed by g++:

> g++ -c testc.cc
testc.cc:21: semicolon missing after declaration of `QI<int>'
testc.cc: In function `int  afunc ()':
testc.cc:23: aggregate value used where an integer was expected
Exit 1
From: cyberman@toz.buffalo.ny.us (Cyberman)
Newsgroups: comp.lang.c++
Subject: OOP in Dynamic simulation
Date: 26 Sep 92 00:30:54 GMT
X-Maildoor: WaflineMail 1.00r

I'm intrested in using C++ for OOP programing in an interactive
simulation.  Does C++ lend to such endevors?  This will make
heavy use of a visual enviroment.

        Stephen Cyberman@Toz.Buffalo.NY.US
        Scripted at Thu  09-24-1992  12:29:30

... This tagline is temporarily out of service.
--- Blue Wave/QWK v2.10
From: jakubik@crchh235.NoSubdomain.NoDomain (Paul Jakubik)
Newsgroups: comp.lang.c++
Subject: Re: GOTOo wars
Date: 6 Oct 92 22:51:05 GMT
Organization: Bell-Northern Research, Richardson, Tx

What if we argued over example code.  In the below pseudo code
op1 op2 ... opn  represent a function call or a few lines of
code that do something useful.  test1 test2 ... testn are
expressions that test if the corresponding op was successful.
err1 err2 ... errn is the return code that should be returned
if the corresponding op failed.

QUESTION:  If the below stream of code appeared in a function,
	   would it break the rules of structured programming?

QUESTION:  If it does, would it still break the rules of structured
	   programming if each return were replaced with an exeption
	   being thrown?  

op1
if (test1)
  return err1

op2
if (test2)
  return err2

...

opn
if (testn)
  return errn

return 0

Consider this example if n > 10.

NOTE - op1 ... opn  are mutually exclusive. 
                    (ie no duplicate functionality)
Newsgroups: comp.lang.c++
From: hoyt@staff.tc.umn.edu ()
Subject: Are template classes allowed as friends?
Summary: How can one specify a template class as a friend.
Keywords: template friend
Organization: University of Minnesota
Date: Sun, 27 Sep 1992 18:02:10 GMT

I want to make a template class a friend of another class.  I've tried
a number of things, but my compiler always complains (Borland C++  3.1).
I want to say something like

	template <class Type} class HashTable ...;
	class Assoc {
		friend class HashTable<Assoc>;
	};

But the compiler yeilds an error "Only classes and functions may be friends."
Are template classes disallowed as friends, or am I just using the wrong
syntax?  If they are disallowed, could someone explain to me why?

Please respond to me directly.  If there is interest I will summarize for the
net.  Thank you.

david | hoyt@epx.cis.umn.edu
Newsgroups: comp.lang.c++
From: Daniel.Parmet@bbs.oit.unc.edu (Daniel Parmet)
Subject: MPW C++
Organization: Extended Bulletin Board Service
Date: Fri, 2 Oct 1992 01:53:33 GMT

What files or libraries are needed to compile and link C++ programs using
MPW C++?

More specifically, I am trying to include the <iostream.h> file, but when
linking, the compiler says that it cannot find this file.  I thought that it
would be in the CPlusLib.o library, but it does not seem to be.

Please reply by mail to udparmet@mcs.drexel.edu.

Thank you.
--
   The opinions expressed are not necessarily those of the University of
     North Carolina at Chapel Hill, the Campus Office for Information
        Technology, or the Experimental Bulletin Board Service.
           internet:  bbs.oit.unc.edu or 152.2.22.80
Newsgroups: comp.lang.c++
Subject: Problem with overloaded * operator
From: srlncnc@gopher.dosli.govt.nz (Chris Crook)
Date: Sat, 3 Oct 1992 01:44:09 GMT
Organization: Department of Survey and Land Information, New Zealand


Apologies to those for whom this is obvious - to me it is definately not.

The problem I have is trying to understand the effect of an overloaded "*"
operator (as used in this case by Borland C++ ).  It is illustrated by the
code below, which defines a string class containing a pointer to a character.
The dereferencing operator "*" is overloaded to return the character pointer.

In the example below the class is instantiated as variable a, with
character pointer theString set to "The text".

I expected that using the overloaded operator *a would return the character
pointer theString.  In fact it appears to return the character 'T' (i.e.
the thing pointed to by theString).

I have looked at several C++ books and still cannot understand this.  I can
only guess that overloading the * operator is working in the same way as
overloading the -> operator, which is that after running the overloaded
operator, the compiler is then applying the real "*" operator to the result.
However this isn't mentioned in any of the books I have looked at (admittedly
they are not definitive sources).  Is this what is supposed to happen? Or am
I missing something very obvious.

A second question I have is about the use of the const keyword in the
declaration of the overloaded operator.  It is defined as

    operator const char *() const;

I am not clear what the effect of the second const is.  Is this equivalent
to "const char const *"??

I would be grateful for any elucidation on either of these question.


Many thanks
Chris Crook

======================================================================

#include <iostream.h>
#include <string.h>
#include <stdlib.h>

class String {

public:

    String( const char *text = "" );
    ~String();
    operator const char *() const;

private:
    char *theString;
    };


String::String( const char *text ) {
    theString = new char[strlen(text)];
    strcpy( theString, text );
    }

String::~String(){
    delete theString;
    }


String::operator const char *() const {
    return theString;
    }

int main( ) {
    String a("The text");
    cout << "a is \"" << *a << "\"\n";
    return 0;
    }

=====================================================================
Newsgroups: comp.lang.c++,gnu.g++
From: geigel@seas.gwu.edu (Joseph Geigel)
Subject: g++ compatable with 2.0 Language Spec?
Organization: George Washington University
Date: Tue, 29 Sep 1992 15:47:57 GMT


Hello...

   Does anyone know if the latest version of g++ is compatable with
AT&Ts C++ v2.0.  Please e-mail.



                               Thanks in advance,

                                   -- jogle
                                      geigel@seas.gwu.edu



-- 

                            -- jogle
                               geigel@seas.gwu.edu

Xref: sparky comp.lang.c++:14580 comp.std.c++:1327
From: nh@cbnewsg.cb.att.com (nicholas.hounsome)
Newsgroups: comp.lang.c++,comp.std.c++
Subject: Re: Should friends obey access?
Date: 6 Oct 92 08:45:55 GMT
Organization: AT&T

From article <WARSAW.92Oct5181127@anthem.nlm.nih.gov>, by warsaw@nlm.nih.gov (Barry A. Warsaw):
> 
> Here's something I've been thinking about for a little while.  Why not
> have friend declarations obey access specification?  Thus, declaring
> something as a friend would only extend friendship to the part of the
> interface in which the declaration was included.  Here's a concrete
> example:

I strongly support this idea. Friends are great but there are
close friends, friends and aquaintances with the latter two usualy more
numerous than the former. The idea is simple to implement and requires
no new syntax so why not.

Nick Hounsome
Newsgroups: comp.lang.c++,comp.std.c++
From: pete@genghis.borland.com (Pete Becker)
Subject: Re: Conceptual Constness
Originator: pete@genghis.borland.com
Keywords: const, const member, lazy
Organization: Borland International
Date: Wed, 30 Sep 1992 17:01:32 GMT

In article <1992Sep29.160411.9737@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>In article <1992Sep29.140750.29438@wam.umd.edu> krc@wam.umd.edu (Kevin R. Coombes) writes:
>>
>>My first complaint is that
>>	operator[](int index)
>>should not be a member of a list class. Lists only provide sequential
>>access; Arrays provide random access.
>
>	I dont agree really. If you can get the first element,
>and get the next element, then you can get the n'th element.
>As far as I'm concerned, a list is an array with 'insert' and 'remove'
>operations.
>
>	However, it is true that one can have a list *iterator*
>than cannot be rewound, and which can only get the next element.
>Thus it is list iterators that supply sequential access, not lists
>themselves. 
>	

	I take a different view of this.  An array is characterized by indexed
access.  It can be implemented with a list, it can be implemented with a
vector, it can be implemented with a btree, and it can be implemented in many
other ways.  But regardless of the implementation that's chosen, operator[]
is always available, and always has the same semantics.  A program that uses
an array to hold its data will continue to work correctly (neglecting speed
and space considerations) when the underlying implementation of the array
is changed.
	Iteration is really a separate problem. 
Xref: sparky comp.lang.c++:14213 comp.object:3720
From: objsys@netcom.com (Bob Hathaway)
Newsgroups: comp.lang.c++,comp.object
Subject: Re: **WANTED: Graph Theory appl. in OO systems**
Keywords: HELP!
Date: 27 Sep 92 05:15:14 GMT
Organization: Object Systems

In article <lbvvodINNjgb@nada.cs.utexas.edu> javier@cs.utexas.edu (Javier H. Seen) writes:
>...
>Are there any good applications of graph theory in the design and/or
>testing of OO systems?  If so, how far has research gone?  Any
>references?  Any actual systems built with graph theory used as
>a litmus test or a design or verification tool for the OO system?
>
>Please, my team and I have scourged through library and electronic
>reference materials, without any success so far.  If you have
>something, please send me e-mail to

What kind of application are you looking for; use in systems or general
applications?  I use "graph theory" and work with graphs all the time in
OO systems (compiler/language) development but only occasionally at the
"user level"; is this what you mean?  It'd be easier to help if you were
more specific about your application domain.

bob
objsys@netcom.com
Newsgroups: comp.lang.c++
From: feist@bau20.cad-bau.uni-hannover.de (Michael Feist)
Subject: NIHCL error on HPUX
Organization: RRZN
Date: Tue, 6 Oct 1992 14:25:40 GMT

I have compiled the whole nihcl on my HP under hpux.
The only mistake I get is by running the example 7-3 for object read from file.
I get the following run time error:


NIHCL: fatal: [RDWRONGCLASS] Tried to read object of wrong class: expected s, was s

This is a very mysterious error message for me.

Is anybody else working with NIHCL under hpux.




--
_______________________________________________________________________________
			     Michael Feist	
Institut fuer Stroemungsmechanik und Elektronisches Rechnen im Bauwesen; 
			Universitaet Hannover
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Newsgroups: comp.lang.c++
Subject: Re: Segmentation fault
Date: 6 Oct 92 16:53:24 GMT
Article-I.D.: mksol.1992Oct6.165324.5488
Organization: Texas Instruments, Inc

In article <1992Oct5.100613.16093@nntp.hut.fi> s36474r@kaira.hut.fi (Mikko Malinen) writes:
>I compiled a C++ program with g++ compiler in IBM 6000.
>Could anybody tell me why the runtime error "segmentation fault"
>occurred? The compiler did not give any error messages.
>

Your program attempted to access some memory location outside its
allowed memory segment.  This usually happens when you read/write too
far on data structures (like strings) or when you access an object
through an invalid or uninitialized pointer.


-- 
"Insisting on perfect safety is for people who don't have the balls to live
 in the real world."   -- Mary Shafer, NASA Ames Dryden
------------------------------------------------------------------------------
Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
From: jbn@lulea.trab.se (Johan Bengtsson)
Newsgroups: comp.lang.c++
Subject: Re: declare keyword, type inference
Date: 5 Oct 92 18:06:20 GMT
Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
X-Newsreader: Tin 1.1 PL4

maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
: 
: 	One very annoying thing in C++, especially templates,
: is that constructors are not inherited. The typedefed Foo
: has user constructors, the derived on doesnt.
: 
: 	Many of us are annoyed with this I think, often we
: have a class B and want to add one more function,
: so we derive a class D from it and have to redefine all
: the user constructors. That redefinition is trivial:
: 
: 	D::D(T1 t1, T2 t2, ...) : B(t1, t2, ...) {}
: 
: but there could be lots of them.
: 
: 	Probably, the function should have been added as a global
: function. In general, it doesnt make sense to inherit constructors.

Agreed, but sometimes it would be nice to have those constructors
generated for you.  That is, you would not _inherit_ the user constructors,
you would have the trivial redefinition described above _generated_
by the compiler.

When multiply inheriting several base classes, of which all except one
have only default (and copy) constructors, it would also be possible
for the compiler to generate constructors for you.

An example:

Suppose you implement persistent classes by inheriting from the
PersistentMixin class:

class MyPersistentClass : public PersistentMixin, public MyClass {
    MyClass( /* several arguments */ )
	: MyClass( /* the same several arguments */ ) {}
};

Doing this for every persistent class is tedious, and a candidate for
a template:

template <class T>
class Persistent : public PersistentMixin, public T { };

Alas, this does not work, since Persistent<MyClass> does not have
the same constructors as MyClass.  Also, Persistent<T> is only
accepted by the compiler for classes T that have a default constructor.

I think compiler-generated user constructors would enable a very lean
combination of templates and mixin-style MI.  Or is there already a nice
way to do the same thing?

-- 
--------------------------------------------------------------------------
| Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
| Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
--------------------------------------------------------------------------
Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Why can't derived classes in templates be assigned.
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Sat, 26 Sep 1992 14:39:43 GMT

In article <1992Sep25.182605.24126@genghis.borland.com> pete@genghis.borland.com (Pete Becker) writes:
>In article <5051@daily-planet.concordia.ca> marcap@cs.concordia.ca (PAWLOWSKY marc) writes:
>>The problem I am having now is that I am implementing a smart pointer
>>template class based on the code on page 472.  The code defines
>>
>>template <class T> class Handle;
>>
>>Now I have class Axis; and class Axis_Regular: Axis, 
>>class Axis_Irregular : Axis.
>>
>>So instead of passing pointers I pass handles around.  All is
>>fine, except with pointers I could do the following
>>
>>Axis *a = 0;
>>Axis_Regular *r;
>>Axis_Irregular *i;
>>
>>if (random() % 2) {
>>    a = r; 
>>} else {
>>    a = i;
>>}
>>
>>But the following can't be done with handles, since
>>Handle<Axis> a;
>>Handle<Regular> r;
>>
>>a = r; // is no good.
>>
>>So does anybody have any ideas on how to make a nice interface
>>to allow me to do this?

	You cant do this, the language requires extensions.
[Somebody shoot me down *please* and show how it can be done!]
What we have with pointers/inheritance is summaried by say that
the diagram below commutes

	B ====> B*
	|	|	===> means take pointer
	V 	V	| means inheritance
	D =====> D*

That is, going from B to D* is the same whether via B* or D.
(I might have some arrows backwards, I hope you get the idea :-)
It is this diagram that allows polymorphism to work.

What you want is for HANDLE to work like pointer:

	B ===> HANDLE<B>
	|	|?
	V	V
	D ===> HANDLE<D>

That is, for this diagram to commute.  But it doesnt.
There is NO relationship between HANDLE<B> and HANDLE<D>.
In other words, the 'make it into a HANDLE' operator
is not the same type as the 'make it into a pointer' operator.

Note that you CAN derive a class D_Handle from B_Handle:

	B ====> B_Handle
	|	|
	V	V
	D =??=> D_Handle,

but it doesnt commute either because now D is not related to D_Handle
in the proper way.

Any proper generic 'smart pointer' mechanism must create a
commuting diagram just as real pointers do (otherwise they cannot
be used like real pointers).

Templates cannot provide this mechanism at the moment.
(I dont think there is any other way either)

I dont have any idea of how to provide this mechanism, but
if such a mechanism could be found, it would be a major 
extension to C++.

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
Newsgroups: comp.lang.c++
From: frank@Cookie.secapl.com (Frank Adams)
Subject: Re: declare keyword, type inference
Date: Tue, 06 Oct 1992 21:29:07 GMT
Organization: Security APL, Inc.

In article <1992Oct6.160634.5475@kodak.kodak.com> cok@islsun.Kodak.COM (David Cok) writes:
>I wonder how often people have explicitly declared something "auto"?
>Adjusting the meaning of "auto" would break C compatibility, but I 
>am not sure it would break a lot of code. (At least it wouldn't break mine.)

But that restricts use of the feature to auto variables; it would be at
least also useful for static variables.  It also gives "auto" an additional
meaning which has nothing to do with its normal meaning, and which is
different from other keywords like it (extern, static, etc.).  This would be
*very* confusing to someone learning the language.
Newsgroups: comp.lang.c++,comp.std.c++
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: declare keyword, type inference
Keywords: declare, type inference
Organization: Computer Science, University of Melbourne, Australia
Date: Fri, 2 Oct 1992 05:05:10 GMT

maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:

>How do you feel about:
>
>	int x,y;
>	long z;
>
>	declare var=z+x*y;
>	declare const cvar=x/y;
>
>that is, when 'declare' (or dcl for short like PL/1) is used,
>the type is infered from the initialisation. Am I correct in
>assuming that the type is always determined?
>
>Would this be 'a good thing' or do you hate it?  Does the syntax
>actually work?

Not the dreaded... NEW KEYWORD!!
Well I guess that it doesn't *quite* clash with the macro "declare"
in <generic.h>, since that macro takes two parameters.

What about declaring references? Would it work like this?
	declare& ref = x;

Actually, there is prior art in the form of an extension with similar
functionality in gcc, the "typeof" keyword. You could then do something like
	#define dcl(var,expr) typeof(expr) var = (expr)
	dcl(var,z+x*y);
to get what you are looking for, albeit with a very ugly syntax.

Seriously, I don't think that it is worth the effort.
Judicious use of typedefs achieves 90% of what you are after.
You've got a snowflake's chance in hell of getting it into the standard :-)

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
Newsgroups: comp.lang.c++
From: mstacey@stealth.mcs.kent.edu (Michael Stacey)
Subject: Porting COOL to hp
Organization: Kent State University
Date: Fri, 2 Oct 1992 21:27:55 GMT

Has anyone had any luck porting the COOL library to HP 700 series machines?
I have been wrestling with this in my spare time for a week and could use some
help if anyone can supply ftp locations etc...

-- 
+--------------------------------------------------+--------------------------+
| Michael Stacey                                   | 
| mstacey@mcs.kent.edu				   |  |
| Department of Mathematical and Computer Sciences |			      |
| Kent State University				   |	                      |
| Kent, Ohio  44240				   |                          |
+--------------------------------------------------+--------------------------+
Newsgroups: comp.lang.c++