HDTenEightyP/NetNews huggingface dataset:
From: steve@taumet.com (Steve Clamage)
Subject: Re: When Are Global Objects with a Constructor Initialized?
Organization: TauMetric Corporation
Date: Mon, 25 Jan 1993 17:46:02 GMT

mbersohn@alchemy.chem.utoronto.ca (M. Bersohn) writes:

>	Does anyone know when global objects of a class with
>a constructor that does initializations are initialized,
>at compile time or at the beginning of execution?

Global objects with constructors are initialized before the first
statement of main() is executed.  Within one compilation unit, they
are initialized in definition order, except that objects with a
default initialization to zero are initialized first.  The C++
Committee is working on a way to specify that objects initialized with
constant expressions get initialized before other objects.  (Current
implementations usually work this way anyhow.)

>P.S. I'm aware that aggregates with an initialization list
>are initialized at compile time, but a constructor looks
>like code that is executed.

"Compile-time initialization" is not a C++ concept (nor a C concept).
For example, consider this entire translation unit:
	extern int i;
	int *ip = &i;
This is legal code in C and C++, yet the compiler (assuming a separate
linker) cannot provide the value for the initialization of "ip".
Suppose further that "i" is in a shared, dynamically-linked library.
We would not even have link-time initialization in that case.  The
address is not known until the program is loaded into memory and the
program loader (not the object-code linker) finds the library.

C requires that objects with static duration be initialized only
with constant expressions (without going into all the details).

C++ allows such objects to be initialized with anything which may
be used to initialize a dynamic object of the same type.  As noted
above, current implementations usually arrange things so that
initialization with constant expressions occurs prior to the program
beginning execution, thus requiring no run-time code.  Objects with
non-constant initializers generally require run-time code which is
part of the program.

-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Newsgroups: comp.lang.c++
From: baraff+@cs.cmu.edu (David Baraff)
Subject: static constructor order question
Organization: School of Computer Science, Carnegie Mellon
Date: Thu, 28 Jan 1993 12:31:40 GMT

I just switched to a compiler where it appears static constructors
from libraries *aren't* called first, and I realized the
following: (so my question is, is the following correct?)

Suppose "class helper" is a class with a constructor.
Then suppose

class foo {
	static hlper important;

	foo() { ... code depending on 'important' having been constructed }
	...
};

Now suppose that I have a nonlocal static foo i.e.

/* file.c */
#include	<whatever.h>

foo my_object;

---------
So when my program begins, I expect 'my_object' to be constructed
before main starts executing (or at least before 'my_object'
is ever used). But because 'important' is not a member of 'my_object',

	 there is no guarantee that 'important' will have been
 	 constructed before 'my_object' is??

Is that right?

	-- David Baraff
	baraff@cs.cmu.edu





Newsgroups: comp.lang.c++
From: pjl@cs.uiuc.edu (Paul Lucas)
Subject: Re: What is bus error ??
Organization: University of Illinois at Urbana-Champaign
Distribution: usa
Date: Wed, 27 Jan 1993 16:07:51 GMT

In <9301271441.AA09698@peacock.cis.ohio-state.edu> ychung@news.cis.ohio-state.edu (yiu fai chung) writes:

>Sometime I got strange error message like "bus error" when I was using
>C++. Does anyone know the reason ?

	A bus error can mean:

	1. odd pointer value on an even-pointer architechure machine.
	2. addressing value outside your address space.

	Any language that allows direct pointer manipulation can cause
	bus errors, not just C++.  You have a bug in your program.
-- 
	- Paul J. Lucas
	  AT&T Bell Laboratories
	  Naperville, IL
Newsgroups: comp.lang.c++
From: VAAGA@gribb.hsr.no (Vaaga, Hans Egil       7-93)
Subject: Microsoft C/C++ Programming by Steve Holzner. Books
Organization: Rogaland University Centre
Date: Thu, 28 Jan 1993 10:30:03 GMT

Hello!

I'm going to buy a C++ book. Could anybody tell me what I should buy?

I'm going to devolope a C++ program in the Microsoft Windows enviroment,
so I wonder if the book Microsoft C/C++ Programming by Steve Holzner is
a good choice. 


Hans Egil Vaaga
Rogaland University Centre
vaaga@gribb.hsr.no
Newsgroups: comp.lang.c++
From: boyle@gca.com (David Boyle)
Subject: Re: Is it legal to have 'return;' in a constructor?
Organization: GCA Corporation
Date: Mon, 25 Jan 1993 16:27:37 GMT

In article <1993Jan18.233147.8573@leland.Stanford.EDU>, kmh@leland.Stanford.EDU (khanhmy hoang) writes:
> 	A Microsoft C++ manual says constructor can't have the 'return;'
> 	statement but the Borland C++ compiler doesn't complain when I
> 	inserted 'return;' into a constructor definition.
> 	Who is correct?
> 

From the ARM, section 6.6.3:

"A return statement without an expression can be used only in functions that do
not return a value, that is, a function with return type void, a constructor,
or a destructor."


--
David Boyle                            ...uunet!gca!boyle  or  boyle@gca.com
GCA, a unit of General Signal          (508) 837-3869
Andover, MA  01810
Newsgroups: comp.lang.c++
From: gwkfong@ntuvax.ntu.ac.sg (Fong Whye Koon)
Subject: Scott Robert Ladd's (Buggy?) code in "C++ Components & Algorithms"
News-Software: VAX/VMS VNEWS 1.41    
Organization: Nanyang Technological University - Singapore
Date: Fri, 29 Jan 1993 04:42:00 GMT

Hi,
  I wonder is anybody using the above book. I have some problems with the
virtual functions code in the ErrReporter class as well as problems with
the BoyerMoore search class. I am using the code with BC++ 3.1 and windows
programming. The program I'm writing hangs when I search for certain pattern
with the BoyerMoore class but works perfectly fine when I substitute in the
GREP functions using the excellent shareware GREP.DLL from Chris Roberts. 
The ErrReporter class fails to report anything to me because the derived
WinErrReporter (similar to DosErrReporter class in the book) gets truncated
when I try to set the errorhandler  to this object.
   I hope someone can provide me the internet/compuserve address of Scott Ladd
so that I can find out what's wrong with the class libraries. The book says
that all code has been tested with BC++3.0, but is it compatible with BC++
3.1 and windows programming? I spent quite an amount on this book and so I
would like to see my investments not failing on me. I have spend many days on
trying to figure out what's wrong but to no avail, need somebody like Scott
to point me out there. Please give me some leads on how to contact the great
Scott Ladd, I have nearly given up hope on the code in this book-no offense
meant.

Thanks in advance
Fong
Nanyang Technological University 
Newsgroups: comp.lang.c++
From: euamts@eua.ericsson.se (Mats Henricson)
Subject: Re: Is (p) instead of (p!=NULL) portable?
Reply-To: euamts@eua.ericsson.se
Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
Date: Mon, 25 Jan 1993 17:32:41 GMT

In article 29030@ugle.unit.no, robert@alkymi.unit.no (Robert Schmidt) writes:
>
>In PC C's, the NULL pointer is defined with a bit pattern of all zero's,
>and the constructs 
>      if (p)
>and
>      if (!p)
>checks for NULL and non-NULL respectively.  Is this portable to *all*
>platforms?

There was a long discussion on this some months ago, and if I remember
the outcome correct, the answer is "YES".

Mats Henricson
Ellemtel Telecom Systems Labs
Stockholm
Sweden

Newsgroups: comp.lang.c++
From: mbenson@gmuvax2.gmu.edu (Michael Benson)
Subject: Help with the linking of C and C++ files.
Keywords: C++ object C link
Organization: George Mason University, Fairfax, Virginia, USA 
Date: Fri, 22 Jan 1993 05:34:08 GMT

I need some help.

I have a piece of code which I know compiles correctly into an object
file.  The code is in the Microsoft C language.  It has a header file
that properally defines the prototypes.  

I include the header  file in a new program that is written in Borland
C++ (version 3.1).  It compiles fine, but fails to link.  It gives the
error "undefined symbol xxxxx in module xxx.cpp"  I know that for some
reason the linker doesn't want to recognize the code in the c routine.
I have tried (maybe naively) to use extern "C" with the header file, but
that failed.  

The C code is just a standard function:
int function ()
{ (somecode) };

and the CPP code just calls it.  

Any ideas?  I have already wasted 12 hours today alone.

Michael

Newsgroups: comp.lang.c++,comp.object
From: samantha@shell.portal.com (Samantha Atkins)
Subject: Re: Pros and cons of C++
Organization: Portal Communications Company -- 408/973-9111 (voice) 408/973-8091 (data)
Date: Tue, 26 Jan 1993 07:15:03 GMT

In article <TMB.93Jan14144656@arolla.idiap.ch> tmb@idiap.ch writes:
>In article <1993Jan13.215141.14487@informix.com> cshaver@informix.com (Craig Shaver) writes:
>
>   We have been fed strong type checking for some time via Nick Wirth and
>   the original pascal teaching language.  This led to ADA which is still-born
>   in the commercial world.
>
>Pascal's, Ada's, and C's type systems are quite antiquated. Many
>modern "strong" type checkers (static type checkers) are very
>expressive and flexible; for much of the code written for such type
>checkers, you wouldn't even be able to tell whether the code is
>statically or dynamically typed.
>
>					Thomas.

Hmmmm.  It seems to me that a couple of problems exist with all the static
type languages (compile time checking) that I am familiar with.

The first problem is that such languages require recompilation of any and
all affected code whenever the type hierarchy is reworked even if this 
results in no changes at all to the behavior of any objects in the application.
In practice for larger projects this is an unholy terror.  I may be wrong
but I thought that one of the blessings of OO was being able to refine a
design even with working code in the field with little or no impact.  

The second problem is related in that most such languages use type based
checking.  It seems to me that what we are really concerned with is:
	a) does this object understand the message we are sending?
	b) does its behavior conform to what we intended in response?
No object language I am aware of does a message based much less a decent
semantic based check.  So in what way has safety been assured really?
Only in that the type understands the message.  OK.  So if I want to get
the maximum flexibility I would probably tend to factor my class hierarchy
very highly with lots and lots of mix-in classes for every reasonable 
set of behaviors.  Then for working classes I would mix and match to 
produce just what I need.  Here we run into some sticky situations in that
not only would I need all these little mixins but I would also quite likely
need various equally abstract classes that represent various combinations
of them as my typing of say, parameters, is only class based and I want to
leave maximum flexibility and reuse in.  Now it seems pretty obvious to me
that over time I'm going to want to change this around or add more combinations
as I can't just declare the whole exponential mess right the first time.  
Also we would have to contend with the unpleasant fact that all this churning
through this exponentially growing hierarchy takes real CPU time and resources
that eventually will get very seriously strained.

Am I going askew here or is it as it seems to me that so called strong typing
creates an untenable mess if you seriously attempt its use now and for the
future?

Comments?

Samantha Atkins
Object Enterprises
From: nikki@trmphrst.demon.co.uk (Nikki Locke)
Newsgroups: comp.lang.c++
Subject: Re: FAQ
Date: 27 Jan 93 11:12:43 GMT
Reply-To: nikki@trmphrst.demon.co.uk
Organization: Trumphurst Ltd.
X-Mailer: cppnews $Revision: 1.31 $

In article <RKOHLBUS.19.727736286@jennifer.umd.edu> RKOHLBUS@jennifer.umd.edu (Robert C. Kohlbus) writes:
> 	I'm looking for an FAQ to this news group if one exists.  
The C++ FAQ can be obtained ...

Via ftp - Anonymous ftp from sun.soe.clarkson.edu [128.153.12.3] :pub/C++/FAQ

Via mail - send mail 
To: archive-server@sun.soe.clarkson.edu
Subject: send C++/FAQ

Many thanks to Marshall Cline for compiling and maintaining it. 

[ Aside to Marshall - is this information still valid ? Do you still 
maintain the FAQ ? ]

-- 
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: jurlwin@gandalf.UMCS.Maine.EDU (Jeff Urlwin)
Subject: Re: C++ compilers and OS/2
Organization: University of Maine, Department of Computer Science
Date: Fri, 22 Jan 1993 00:44:42 GMT

In article <1993Jan18.090225.16828@greco-prog.fr> rabussea@jack.greco-prog.fr (Denis Rabusseau) writes:
>
>Can someone give a list of C++ compilers for OS/2 v2.0 and more ?
To the best of my knowledge:

Zortech C++
Microway C++
Borland C++ (in beta, was due 4th Q last year, now 1st Q this year)
IBM C++ (in beta (really alpha...) don't know when it's due)

Jeff

-- 
--------------------------------------
jurlwin@gandalf.umcs.maine.edu

Newsgroups: comp.lang.c++
From: froelich@mrcnext.cso.uiuc.edu (Bill Froelich)
Subject: C++ Class defs for Paradox Engine
Organization: University of Illinois at Urbana
Date: Sun, 24 Jan 1993 04:28:02 GMT

I am looking for C++ defs for use with the Paradox Engine.  Anyone know
of any avail on ftp?

Please respond via e-mail since i don't get the chance to read this group much

Thanks in advance

--Bill Froelich
  froelich@mrcnext.cso.uiuc.edu

Newsgroups: comp.lang.c++
From: feist@hp1.erib.uni-hannover.de (Michael Feist)
Subject: NIH - I/O error
Organization: IfSuERiB, Uni Hannover, Germany
Date: Mon, 25 Jan 1993 10:27:57 GMT

The NIHCL-lib is running very well on my HP under hpux.
The only thing, which will not work, is:

NIHCL: fatal: [RDUNKCLASS] Tried to read object of unknown class Float

Has anybody an idea, why only the class "Float" will not be able to read,
all other classes are possible, including dictionary and so on ?


______________________________________________
    Michael Feist	feist@hp1.erib.uni-hannover.dbp.de
Institut fuer Stroemungsmechanik und Elektronisches Rechnen im Bauwesen 
			Universitaet Hannover
_______________________________________________________________________________

Newsgroups: comp.lang.c++
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Is this C++ advice from an OO book true?  (beginner question)
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
Date: Wed, 27 Jan 1993 17:08:23 GMT

In article <sherman.727849469@foster> sherman@unx.sas.com (Chris Sherman) writes:
>I read the following from a book that adviced how to do software projects
>using OO-type languages.  In one of the appendixes, it gave some advice
>on how to write C++ programs.  
>
>I don't understand one of the book's recommendations:
>
>  11.  Call virtual class constructors in dervied class constructors.

	Yes, you have to do this ...
>
>     I pity the poor fools who have to spend nights and weekends searching
>     for the reason that a class variable occasionally takes on strange,
>     unexpected values .  .  .  only to find through their bleary eyes
>     that they forgot to allocate space for a virtual base (super) class,
>     so that storage is allocated for the base class's members.  Even if
>     the class has no members, declare it--you never know what future
>     changes will come back to haunt you (or the person who inherits your
>     mine field)!

	I dont understand this gibberish either.
>
>Now, I thought that a contructor will allocate everything it needs, even
>if it inherits from other classes.  

	The system -- not the constructor -- allocates storage.
The constuctor is merely responsible for initialising it.

>I never heard that you had to call
>all the constructors in all the bases classes manually.  

	You dont. Only if you have virtual bases requiring
non-default initialisation.

>This kind of
>blows the idea that a class shouldn't have to explicitly know who its
>parents are, right?

	You mean 'grand-parents'. Yes, it blows that idea,
and it is not good. But for virtual bases requiring non-default
initialisation only.
>
>Or if this is very good advice, could someone give an example showing why
>it is true?

	Virtual bases can have more than one child.
Which one is responsible for supporting the virtual base in its old age? 

	Answer: none of them, the the very youngest descendant only: 
the most derived class.

	Why? Well, what is a better way to decide?
The initialising class must be uniquely determined somehow.

>
>This is a beginner question obviously--thanx for any help!

	Its NOT a beginner question. You are perfectly correct
in observing that for virtual bases that non-default initialisation
by the most derived class has the unfortunate consequence
that you have to know all the virtual bases in the subobject
DAG that require non-default initialisation, and then
initialise them.

	This is not good (the grandparents of a class should
be anonymous). But it seems hard to find a better way.

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;------ SCIENTIFIC AND ENGINEERING SOFTWARE ---ph:  2 799 8223 --------
Newsgroups: comp.lang.c++
From: erc@netcom.com (Eric Smith)
Subject: Re: C++ maintenance
Organization: Netcom - Online Communication Services (408 241-9760 guest)
Distribution: na
Date: Sat, 23 Jan 1993 23:04:14 GMT

In article <C1BnAy.C3F@geovision.gvc.com> djb@geovision.gvc.com (Darren Burns) writes:
>
>I recently had the pleasure (not) of trying to track down a bug in
>some C++ code.  The author(s) of the code were not that experienced
>in C++, but I don't think that matters here.
>
>I just wanted to get some comments about the following.  Suppose I'm
>looking at a C++ program.  I have a pretty good understanding of what
>it does, but I'm not terribly familiar with the code.  In a member
>function I see:
>
>int the_class::do_something ( )
>{
>...
>    foo->xxx();
>...
>}
>
>Now, I'm browsing through this code and I'm thinking maybe the bug I'm
>looking for is in xxx().  I want to take a look at it.  In order to know
>which xxx to look at (since there may be many classes that have xxx), I
>need to know what class foo is.  But foo could be a global variable,
>a member of the_class, or a variable local to the function.  I have to
>hunt all over the place just to find out where to look for xxx.
>
>I find this a real pain.  I'm not experienced with C++, so maybe it's
>something you get used to.  I think that it's a general problem with
>OOP, although the syntax of the language can make it better or worse.
>It seems that C++ is great if you know the program very well (i.e. if
>you designed/wrote it), but is difficult to maintain.
>
>Are there others who find the same thing?  Is there some way of setting
>things up to avoid this sort of problem?
>
>Thanks.
>
>(I never did find that bug, by the way :-))
>
>Darren Burns


You need a browser which will let you click your mouse on foo and/or
xxx rather than searching for it.  The browser will show a window with
the class or function definition, and you can then click on something
in that window to get another such window, etc.  For example, if you
click on foo in your example above, you get a window showing the
definition of foo, which will show you its class.  Suppose that class
is fooclass, you then click on the word fooclass to get another window
showing class fooclass.  Inside of class fooclass you might see a
declaration of xxx, so you would click on xxx to get a window showing
fooclass::xxx, and then you could look inside the function block of xxx
in that window and click on other stuff the same way.  Or, instead of
clicking on foo in the first place, you can click on xxx and get the
fooclass::xxx window immediately.
From: donini@masg1.epfl.ch (Pier Donini)
Newsgroups: comp.lang.c++
Subject: C++ library
Keywords: C++, Techniques & Applications, Scott Robert Ladd
Date: 25 Jan 93 23:39:44 GMT
Organization: Ecole Polytechnique Federale de Lausanne


	I'm trying to learn C++ by myself and borrowed a book at the school library :"C++ Techniques & Applications" by Scoot Robert Ladd. This is book
is really good. Even if i'm not a guru programmer i understood almost all of the ideas and example given in the book.
	The problem is now that at the end of the book are given a lot of
listing from the example in the book. These examples are interesting coz they describe some basic class definitions that could be used in many applications. The book can be buy with a disket with the programms but eh ... i don t have the
disk. Could someone help me to find these library ... coz it would let me loose
a lot of time to have to type them.

Thanks for your time,
Big Cat

P.S : please answer me if possible at this address : rochat_p@elde.epfl.ch
Newsgroups: comp.lang.c++
From: pandrews@lovat.fmrco.com (Paul Andrews)
Subject: Re: MI vs. SI
Reply-To: pandrews@lovat.fmrco.com
Organization: Fidelity Investments Ltd.
Date: Thu, 21 Jan 1993 09:39:18 GMT

In article 18020@borland.com, pete@borland.com (Pete Becker) writes:
> In article <93019.090854IO70620@MAINE.MAINE.EDU> <IO70620@MAINE.MAINE.EDU> writes:
> >The only way I can think of to enforce this is
> >through the use of multiple inheritance.
> 
> 	Then use multiple inheritance.  It is not a "Pandora's box", except
> to those who jump into hacking code without thinking about what they are doing.
> But that sort of problem isn't limited to multiple inheritance...
> 	-- Pete
> 
Totally agree. Why oh why oh why (:-)) do folks have such a downer on MI? YES, I
suppose you can do the same stuff with SI, but thats like saying "I can get from
A to B by walking, why drive?" (well kind of). The point is MI is USEFUL. As people
have said before: "Use it for Mixins". There is too much design of classes that
can't be re-used for various reasons (private not protected members, standard not
virtual functions (esp. destructors), monolithic SI class libraries).

If you want to see the best argument yet for MI, take a look at NIH (it uses SI). The
library would have been much more useful written as a set of Mixins. Programmers could
then decide for themselves which parts of the Object class they wanted in their
programs. (P.S. NIH was first written prior to MI).

Anyway, enough ranting for now.

(Needless to say, my opinions are my own)

- Paul


---
---
Paul Andrews

EMail				Telephone
pandrews@lovat.fmrco.com	+44-71-975-4723

Newsgroups: comp.lang.c++,comp.sys.ibm.pc.misc
From: lawsengd@nuscc.nus.sg (Seng Kiat Boon Danial (Mr))
Subject: Re: BC 3.1 has DPMI error on my machine
Organization: National University of Singapore
X-Newsreader: Tin 1.1 PL4
Date: Thu, 28 Jan 1993 09:39:27 GMT

To get my BC++ 3.1 to work on my 286 with 4 MB DRAM, I did the following:

1. Commented out the DEVICE=HIMEM.SYS instruction in CONFIG.SYS
2. Disabled all A20 control (my Chipset allowed me to permanently enable the
   A20 line)
3. Started the system from afresh
4. Ran DPMIINST
5. After DPMIINST registered the machine configuration in the database, I
   restored the commented line in CONFIG.SYS (ie. undo steps 1 & 2).

It worked subsequently.

Please try this out and let me know if it works.  Regards.
From: andy@elviss.eng.sun.com (Andrew Davidson)
Newsgroups: comp.lang.c++
Subject: Re: Why is C++ not considered a true OOL?
Date: 22 Jan 93 10:29:31
Organization: MASTERS OF THE KNOWN UNIVERSE
	<1993Jan21.005415.2812@ucc.su.OZ.AU>
NNTP-Posting-Host: elviss
In-reply-to: maxtal@extro.ucc.su.OZ.AU's message of 21 Jan 93 00:54:15 GMT

In article <1993Jan21.005415.2812@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:

>
>The fourth alternative (mixins) is superior :-)
>
>....
>
>...
>
>But your greatest achievement, Bjarne, in my opinion,
>was the name dominance rule, because, coupled with virtual
>bases and abstract classes that enables mixins.
>

what are mix ins?

Andy
Newsgroups: comp.lang.c++