HDTenEightyP/NetNews huggingface dataset:
From: jimad@microsoft.com (Jim Adcock)
Subject: Re: Is this a compiler bug?
Date: 14 Dec 92 21:28:23 GMT
Organization: Microsoft Corporation

In article <1992Dec11.193023.27787@news2.cis.umn.edu> hansen@deci.cs.umn.edu (David Hansen) writes:
|In article <KANZE.92Dec11165414@slsvdnt.us-es.sel.de>, kanze@us-es.sel.de (James Kanze) writes:
|[..]
||> 
||> If your compiler accepts this code, then it is broken.  (I am
||> supposing that NULL is defined as either 0 or 0L; however, in this
||> case, nothing changes if it is defined as (void*)0.)  "fptr" and the
||> results of "(fptr = bar())" are both pointers to member functions, and
||> *not* pointers.  There is no implicit (nor explicit) cast from a
||> pointer to member function to an int, a long, or a pointer, so it is
||> not legal to compare a pointer to member function to NULL.
||> There is *no* special value for pointers to members, the equivalent to
||> NULL for pointers.  So if there are cases where "bar()" cannot return
||> a legal value, some other arrangements must be made for it to return a
||> status.
|
|There is no equivalent to void* for pointers to members -- see p. 70.
|Is this, perhaps, where the confusion might lie?

I think the confusion lies in assuming that ((void*)0) could be an
acceptable implementation of NULL in C++.  ((void*)0) is acceptable
in C.  It is not acceptable in C++.  The rules of pointer type compatibility
have changed, and are more restrictive in C++.  Thus ((void*)0) no longer
flies.  This is a source of frequent trouble for C++ programmers trying to
use old C .h files.

Newsgroups: comp.lang.c++,sci.math.num-analysis
From: jbn@lulea.trab.se (Johan Bengtsson)
Newsgroups: comp.lang.c++
Subject: Re: Overriding the order of constructors?
Date: 14 Dec 92 18:03:28 GMT
Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
X-Newsreader: TIN [version 1.1 + PL8]

Keith Robison (robison1@husc10.harvard.edu) wrote:
: dembo@csri.toronto.edu (Prof. Ron Dembo) writes:

: >What is the rational for not allowing a programmer to override the
: >default calling order of constructors and initializers?  I see
: >the importance of having a well defined default.  However, why
: >shouldn't the ordering of the initilizers be significant?  


: 	I believe you can effectively accomplish this dangerous
: goal by calling virtual functions in your constructors:

: class A {
:   A() { reroute(); do_A_ctor_stuff(); }
:   virtual void reroute(); { }
: }

: class B : public A {
:   B() {}
:   void reroute ()  { do_B_ctor_stuff(); }
: }


: This will cause B's reroute() to be executed before any 
: A constructing has occurred.

Wrong.

When inside A::A() even a B object behaves _exactly_ as though
it was an A object.  In particular, calling virtual functions
from the constructor of a will _never_ call redefined functions
in derived classes.  I won't comment on the other small errors
in the suggested code.

[ mini-flame on ]
You should have tested this idea before posting.
[ off ]

The following accomplishes what you are looking for:

class Base { public:
  Base() { cout << "ctor Base stuff\n"; }
protected:
  Base( void (*callback)(Base*), Base* derived )
    {
      if ( callback != 0 ) (*callback)(derived);
      cout << "ctor Base stuff\n";
    }
};


class Derived : public Base { public:
  Derived() : Base(init_derived,this) { }
  friend void init_derived(Base* base);
};

void init_derived(Base* base)
{
  Derived* thatShouldBeADerived = (Derived*)base;
  cout << "ctor Derived stuff\n";
}
-- 
--------------------------------------------------------------------------
| 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: jimad@microsoft.com (Jim Adcock)
Subject: Re: static members in derived classes
Date: 16 Dec 92 19:39:10 GMT
Organization: Microsoft Corporation

In article <5387@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
|I like "virtual static", and I do not need the vtbls to back me up.
|It is more a question of orthogonality and removal of an exception
|to language rules.

As if orthogonality were a goal of C++ ? ;-)

In any case, I don't see where adding "virtual static" makes things 
orthogonal.  It simply adds a third special case meaning to "virtual."
There would remain many different cases of functions and objects of
various storage classes that still couldn't be use "orthogonally" along
with the "virtual" keyword.
From: wilson@cs.utexas.edu (Paul Wilson)
Newsgroups: comp.lang.c++
Subject: overload = for pointers?  redefine pointer decl syntax?
Date: 20 Dec 1992 15:21:02 -0600
Organization: CS Dept, University of Texas at Austin
NNTP-Posting-Host: boogie.cs.utexas.edu

Are there any C++ compilers that let me define my own overloaded
versions of (normally) builtin operations on builtin types?  In
particular, I'd very much like to be able to redefine the way
operator = works on pointers, for garbage collection purposes.
(And maybe redefine it for all primitive types, for checkpointing
purposes.)

Failing that, I have to define my own "smart" pointer classes,
which runs into several problems, as has been discussed before.
One problem is that I can't use the standard pointer declaration
syntax, and therefore have to modify program sources that I'd
otherwise be able to compile without change.  Does any compiler
support "overloading" declaration syntax in any way---that is,
can I have a GC-able class foo and a GC-pointer class gcPtr<foo>,
and set things up so that a declaration like

   foo *myfoo;

is treated as though it were

   gcPtr<foo> myfoo;

(NOTE: I do realize that this is not supported by standard C++,
and it's a weird thing to do, but I'm a professional on a closed
road, as it were.  And when I redefine builtins, I intend to preserve
their standard meanings while adding "extra-lingual" features to
them, like garbage collection and checkpointing.  I want to maintain 
compatibility with existing code as much as possible.)

So the question is: does anybody make a C++ compiler that either
allows me to redefine builtin operators on builtin types, or to
extend the syntax of declarations?

Anybody have an idea how hard each of those would be to hack into
a compiler, say GNU C++?  (It would seem to me that the machinery 
is likely to be mostly there already, for the purposes of getting 
the semantics of inline procedures right.  Maybe the same bookkeeping
could support more general lexically-scoped macros.)

This sort of stuff is trivial in CLOS.  Are there technical
reasons it's difficult for C++?  (I assume it would require
a funkier compiler to support mutable declaration syntax in
a language with nontrivial syntax, but redefining builtin
operations doesn't seem hard at all.  Then again, I'm not
a compiler guy and may underestimate the difficulties.)

Any pointers to useful info or software would be appreciated.

Thanks,

   Paul

-- 
| Paul R. Wilson,   Computer Sciences Dept.,   University of Texas at Austin  |
| Taylor Hall 2.124,  Austin, TX 78712-1188       wilson@cs.utexas.edu        |
| (Recent papers on garbage collection, memory hierarchies, and persistence   |
| are available via anonymous ftp from cs.utexas.edu, in pub/garbage.)        |
Newsgroups: comp.lang.c++
From: eb@ascent.com (Ed Barton)
Subject: Re: Virtual base classes
In-reply-to: roger@genie.UUCP's message of 14 Dec 92 00:20:19 GMT
Date: 15 Dec 92 10:00:43
	<1992Dec8.192759.24081@cs.brown.edu> <445@genie.UUCP>
Organization: Ascent Technology, Inc., Cambridge Massachusetts

In article <445@genie.UUCP> roger@genie.UUCP (Roger H. Scott) writes:
   In article <1992Dec8.192759.24081@cs.brown.edu> sdm@cs.brown.edu (Scott Meyers) writes:
   >In article <rmartin.723768537@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
   >| ... There is nothing that can be done with private inheritance that cannot
   >| be done, just as simply, with containment.
   >
   >Except for redefining virtual functions and accessing protected members.

   If Kludge is a non-public subclass [derived class] of WellFormed then there
   isn't much point in talking about Kludge redefining WellFormed's virtual
   functions since you can't use a Kludge in a place where a WellFormed is
   expected (i.e., who would ever have hold of a Kludge and send it one of
   WellFormed'd messages [call one of WellFormed'd virtual functions], other than
   a member function of Kludge?).

What about member functions of WellFormed that call virtual functions
of WellFormed, expecting that any subclass like Kludge will have
customized the behavior of those virtual functions as needed?

Newsgroups: comp.lang.c++
From: nikki@trmphrst.demon.co.uk (Nikki Locke)
Subject: Can't remember details of a previous article
Reply-To: nikki@trmphrst.demon.co.uk
Distribution: world
X-Mailer: cppnews $Revision: 1.30 $
Organization: Trumphurst Ltd.
Date: Tue, 15 Dec 1992 19:49:43 +0000

Some time ago in this newsgroup I saw a proposal for a language extension 
that interested me. Unfortunately, I was in a hurry at the time, and did 
not note the details.

The idea was that a class could "virtually inherit" in some way from any
class which was a subclass of the one originally specified. The poster 
went into more detail than this, and seemed to suggest that the proposal 
made templates pretty well redundant, and also solved lots of other 
problems.

If anyone posted such a proposal, or remembers the author of the original 
article, please could they mail me with the information ?

-- 
Nikki Locke,Trumphurst Ltd.(PC and Unix consultancy) nikki@trmphrst.demon.co.uk
trmphrst.demon.co.uk is NOT affiliated with ANY other sites at demon.co.uk.
Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: IS C++ a language for the "average programmer"
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Fri, 18 Dec 1992 18:55:11 GMT

In article <1992Dec16.211812.13386@microsoft.com> pauljo@microsoft.com (Paul Johns) writes:
>
>But none of us would return to programming by flipping front
>panel switches....
>

	What do you mean "return"? I still have to flip my PC's
RESET switch quite regularly :-)

	C++, like C, allows you to program close to the machine.

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
From: hendrik@vedge.com (Hendrik Boom)
Newsgroups: comp.lang.c++
Subject: Re: Define WIN30/WIN31 ?
Date: 15 Dec 92 20:27:27 GMT
Organization: Visual Edge Software Ltd.

pete@borland.com (Pete Becker) writes:
: In article <1ge3raINN5k3@agate.berkeley.edu> jeff@emily10.Berkeley.EDU (Jeffrey C. Ely) writes:
: >Why are there errors in Borland's
: >own example source files and header files ?!?  I know I'm missing something. 
: >Can anyone help?
: 
: 	Sounds like pilot error.  Use the .PRJ file or the makefile, rather
: than compiling directly from the command line.
: 	-- Pete
: 
: 
I seem to remember that I had the same problems; the missing Object.h
turned out to be a directory that was left out of the include path.

Perhaps the problem is that I did the obvious when I leafed through the
tutorial and type in the source code myself.  Only much later did I notice
that the code was lying around in one of the directories...
-- 
-------------------------------------------------------
Try one or more of the following addresses to reply.
at work:	hendrik@vedge.com,  iros1!vedge!hendrik
at home:	uunet!ozrout!topoi!hendrik
Newsgroups: comp.lang.c++
From: pete@borland.com (Pete Becker)
Subject: Re: Templates
Originator: pete@genghis.borland.com
Organization: Borland International
Date: Mon, 14 Dec 1992 17:31:19 GMT

In article <1992Dec13.231649.4904@news.cs.brandeis.edu> dernis@binah.cc.brandeis.edu writes:
>Hi,
>  This is a fairly simple template question, I hope.
>I have written a template class, which has been tested and
>appears to work (mostly at least).  Now I tried to use and I 
>have found a problem.
>
>The class is a matrix class, and works with all numerical types
>(I have only tested the two that I need - but presumably).
>
>Now I want to declare a function which returns a complex Matrix.
>
>So I wrote,
>
>Matrix<complex> function();
>
>But I discovered a problem immediately, that this interprets this
>as instance of Matrix<complex>, not a function declaration.  It now
>occurs to me that indeed that is exactly what I have written, and
>it rightfully complains that I left out the arguments.
>

	The declaration above declares a function named 'function' that takes
no parameters and returns a value of type Matrix<complex>.  It's just like
a function declaration that does not use templates:

	int function();

	Either the compiler is confused or there's some missing context in
the original posting.  Oh, one thing that could cause confusion is if the
compiler doesn't know about the Matrix template at the point where this
declaration occurs.  If so, it needs a forward reference:

	template <class T> class Matrix;
	Matrix<complex> funcion();

If the template has already been seen in the same source file, the forward
reference isn't needed.
	-- Pete
Newsgroups: comp.lang.c++
From: klamer@mi.el.utwente.nl (Klamer Schutte)
Subject: Re: Give me safe C++
Organization: University of Twente, BSC-El
Date: Sat, 19 Dec 1992 09:51:53 GMT

In <1992Dec17.192301.23525@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:

:	Next, I feel NO language has addressed the concept
:of coroutines (except possibly Simula?). C provides
:no simple exchange of control mechanism, although one
:has to admit they can be emulated using objects in C++.
:Yet many machines provide this facility, usually via
:some exchange and link instruction.

Occam has the parallel execution option, which can quite easily be used
for coroutine-style programming. Its task switching method also maps
quite well to hardware (to the hardware it was designed for: a transputer).

This makes Occam a good candidate language for problems which need
coroutine style programming. (Lucky me, my problems don't need coroutines :-)

Klamer
--
Klamer Schutte			Tel: +31-53-892778	Fax: +31-53-340045
Faculty of electrical engineering -- University of Twente, The Netherlands
preferred: klamer@mi.el.utwente.nl     SMTP: klamer@utelmi01.el.utwente.nl
Newsgroups: comp.lang.c++
From: steve@taumet.com (Steve Clamage)
Subject: Re: How to call C++ functions in a C program?
Organization: TauMetric Corporation
Date: Fri, 18 Dec 1992 17:35:59 GMT

banshee@natinst.com (Jeff Kellam) writes:

>In article <1gqbepINNt6s@function.mps.ohio-state.edu> ren@function.mps.ohio-state.edu (Liming Ren) writes:
>>
>>I know we can call C functions inside a C++ program. Is there a way to
>>call a C++ function inside a C program?

>Basically, you can't.

Nonsense!  Of course you can.

The method is documented in the ARM, in C++PL2 and in Lippman's C++
Primer, just for openers.  It is guaranteed portable, assuming only
that you have a C and a C++ compiler which were intended to be
compatible.  I don't know of any C++ implementations where this is
not the case.

Look up "linkage specifier" in any good C++ text.

There are a few things to watch out for.  I detailed these in my
article "Linking C++ With Other Languages", in C++ Report,
vol 4, no 4, June 1992.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
From: ram@ramsgi.erenj.com (ram rajagopalan)
Subject:  C++ Courses in East Coast
Organization: Exxon Research & Engineering Co.
Date: Mon, 14 Dec 1992 16:10:39 GMT

HI,

I am interested in attending a course to learn C++.  if anyone could recommend
a good outfit in the east coast which offers courses in C++ I would 
appreciate it.

regards,

Ram.

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

Ram  Rajagopalan                                        Phone: (908) 730-2556
Exxon Research & Engineering Co.                        Fax:   (908) 730-3042 
RT 22 East Annandale, NJ - 08801                        Email: ram@erenj.com

==============================================================================
From: njs@planet.bt.co.uk
Newsgroups: comp.lang.c++
Subject: Re: Survey: File Extension
Date: 16 Dec 92 09:59:46 GMT
Organization: DNM42, BT Labs, Martlesham Heath, Ipswich, UK.
Originator: njs@andromeda


In article <1992Dec12.014834.926@netcom.com>, erc@netcom.com (Eric Smith) writes:
|> In article <78146@hydra.gatech.EDU> andy@federation.gatech.edu (Andy Register) writes:
|> >In article <1gb1h0INNle2@tsavo.hks.com> webb@hks.com writes:
|> > >I have a survey question for you all:
|> > >
|> > >	What extension do you believe is correct for C++ source code?
|> > >	Is a clear majority winner emerging?  The contenders are: .C, .c
|> > >	and .cxx. 
|> >
|> >don't forget .cpp for all us borland users.
|> >
|> >Toodles
|> >Andy
|> 
|> 
|> That's not just Borland.  A lot of other vendors, such as Microsoft and
|> Zortech, use it too.  I think the reason why a lot of Unix compiler
|> vendors didn't like .cpp and used .cc, .C, .cxx, etc. was that the name
|> C++ wasn't originally intended to be pronounced "see plus plus", as the
|> ++ operator was originally called the increment operator, and a lot of
|> C programmers considered people who called it "plus plus" to be
|> uneducated.  But that has gradually changed over the years, and now the
|> majority calls C++ "see plus plus" and uses .cpp as the filename
|> extension.  So we might as well standardize on .cpp, because that's the
|> way it's going anyway and no one can stop it.

Who are you trying to kid?  I've been using this language for years and I have only seen .ccp with my Zortech stuff, and I changed that real quick.  I like .cc, and having .cpp on UNIX platform which has a cpp executable might be a bit confusing for some people.

Nathan
Newsgroups: comp.lang.c++
From: ambler@csri.toronto.edu (Scott Ambler)
Subject: Help! Multi-line TEdit
Originator: root@woodbine.csri.toronto.edu
Organization: CSRI, University of Toronto
Date: 12 Dec 92 22:31:13 GMT

Hi!.  I'm using the Borland C++ 3.1 with Applications Framework.

What I'm trying to do:
I'm trying to use a multi-line TEdit in a dialog box, to no avail.
It's a Windows application.  The dialog box has a TEdit field and
two buttons (OK & Cancel).  I'm eventually going to have more
controls on the panel, but I thought I'd start small.

Problem:
When I press Enter, it reacts as if I've pressed the OK button, and
accepts the input, closing the dialog window.
I want it to go down to the next line in the editing field,
just like a word-processor.

What I've already tried:
I have the editing field defined as multi-edit in the resource file.
I've tried to 'new' the TEdit field using the first two constructor's
in the manual, and I fiddled with the multi-line toggle in the first
constructor, and it didn't do anything.  I even tried not 'new'ing the
TEdit in my .cpp code, and it still didn't work.

My request:
If you have any sample code (.cpp & .rc) that has a multi-line TEdit
in a dialog box, I would be truly grateful if you could Email it to
me.  Thanks ahead of time.

My Gripe(s):
1. Borland support sucks.  Period.  I faxed this problem in to them 9 days
ago, and have heard NADA.  I've phoned in to their "support" line in
the past, in the hopes of talking to a real person.  After 20-30 minutes
of waiting, I finally get somebody who may or may not be able to help.
They don't have a 1-800 number in Canada, and phoning California for
their mediocre service is too much, considering I spend most of the time
waiting.  So I thought that I'd fax them.  Didn't seem to work.

2. I phoned Borland Canada to complain, and all they could tell me is that
if they had a 1-800 number then everybody would use it!  Great service.

3. Unless it's hidden away somewhere, there isn't one single example of
a multi-line TEdit anywhere in Borland's examples.  This isn't a strange
thing to do!

-Scott Ambler
From: ldup@ta7s49.alcbel.be (Luc Duponcheel)
Newsgroups: comp.lang.functional
Subject: Re : for monad lovers only
Date: 18 Dec 92 09:30:22 GMT
Organization: Alcatel Bell Telephone, Antwerpen, Belgium

In his article jones-mark@cs.yale.edu (Mark Jones) 
efines the function swap as follows
>
>        swap []     = [ [] ]
>        swap (m:ms) = [ x:xs | x<-m, xs<-swap ms ]
>


It might not be clear to you all that its definition of swap coincides with 
my definition of swapM_L. 

Here is the necessary argumentation :


appM_L f [] = f []
appM_L f (m:ms) = appM (\x -> appM_L (f . (x:)) ms) m

swapM_L [] = unitM []
swapM_L (m:ms) = appM (\x -> appM_L (unitM . (x:)) ms) m
               = appM (\x -> appM (unitM . (x:)) (swapM_L ms)) m
               = appM (\x -> appM (\xs -> unitM (x:xs)) (swapM_L ms)) m


Comprehension notation is now defined as follows : (where bindM = flip appM)

[ t ]   <==>  unitM t
[ t | x<-m ]  <==>  bindM  m (\x -> unitM t) 
[ t | x<-m , y<-n ]  <==>  bindM m (\x -> bindM n (\y -> unitM t)) 

and so on ...

this means that

swapM_L [] = [ [] ]
swap M_L (m:ms) = [ x:xs |  x<-m , xs<- swapM_L ms]

the same as

swap [] = [ [] ]
swap (m:ms) = [ x:xs |  x<-m , xs<- swap ms]


BTW.

It should be clear by now that his way of defining a swap function
also works with other monads than the List monad.


Consider e.g. binary trees

data Tree a = Node a
            | Tree a :^: Tree a

swap (Node m) = [ Node x | x<-m ]
swap (mt :^: nt) = [ xt :^: yt | xt<-swap mt , yt<-swap nt ]


checking the axioms is another matter ...


Luc Duponcheel
Alcatel Bell Telephone, SE99
Francis Wellesplein 1,
B-2018 Antwerpen
Belgium

    \_        \_\_\_    \_   \_    \_\_\_    
     \_        \_    \_  \_   \_    \_   \_          
      \_        \_    \_  \_   \_    \_\_\_      __o   
       \_        \_   \_   \_   \_    \_       _`\<,_  
        \_\_\_\_  \_\_\_    \_\_\_\_   \_     (*)/ (*)
From: andrew@cs.chalmers.se (Andrew Moran)
Newsgroups: comp.lang.functional
Subject: Re: combinator names
Date: 12 Dec 92 13:11:43 GMT
Distribution: comp
Organization: Dept. of CS, Chalmers, Sweden

Antoni Diller writes:

>Raymond Smullyans's book ``To Kill a Mockingbird'' gives names to
>lots of combinators which are also names of birds; I don't know if
>this will help you.

That's "To Mock a Mockingbird".

>Antoni Diller

Andy