HDTenEightyP/NetNews huggingface dataset:
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c++
Subject: Re: Explanation for "Null pointer assignment"
Date: 4 Nov 92 19:46:39 GMT
Organization: negligable

In article <Bww82p.HIw@peora.sdc.ccur.com> tran@peora.sdc.ccur.com (Nhan Tran) writes:
>
>I am using Borland C++ 2.0. When my program finish, it has a run-time error
>message "Null pointer assignment". According to the manual, 
>
>	"Null pointer assignment" is displayed to inform you that
>	(most likely) a value was stored to an uninitialized pointer.
>	The program may appear to work properly in all other respects;
>	however, this is a serious bug ...
>
>I am puzzled by this. If I declare a pointer without initialzing it, then 
>the program will assign some value to that pointer (by using it) at run-time.

I read the other answers you got, and noone actually seemed to directly
address your question about "the program will assign...", so here goes.

A: Not necessarily.  If I declare:

	char *p;

all I have is a pointer to somewhere.  Perhaps initialized to NULL, 
perhaps not.  If you are counting on "the program" to assign a value
to that "by using it" you are either under a misapprehension, or I
misunderstand your statement.  You MUST at some point in time point
that pointer to some specific place:

	p = malloc(81);			/* dynamically allocated memory */
	p = &some_other_var;		/* address of some other var */
	p = some_other_ptr;		/* a copy of another pointer */
	p = (char *) 0xA000;		/* hardware dependant address */

>What is wrong with that?  Or the above explanation implies something else?

If you do NOT assign some sort of legitimate value to the pointer
you have declared, and then attepmt to use it:

	*p = 'X';

you could be writing ANYWHERE.  This gets you a "memory protection fault"
on machines that support such things directly.  A "NULL pointer assignment"
assignment on machines that a) init pointers to NULL, and b) check for
such things (as described in a parallel answer).  On machines that don't
do either of these your 'X' could wind up almost anywhere in memory
with effects that may not be discovered until the most inconvenient time...



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lovely to see you again my friend,		|
walk along with me to the next bend.		|	-Richard Hartman	
Tell us what you've seen			|	hartman@uLogic.COM
in far away forgotten lands,			|
Where empires have turned back to sand.		|
		-Justin Hayward			|
Newsgroups: comp.lang.c++,gnu.g++.help
From: enewton@uucp (Eric Newton x2092)
Subject: Re: linking problem using class CursesWindow in libg++-2.2
Reply-To: uunet.uu.net!srg!enewton
Organization: means "in a rut"
Date: 6 Nov 92 11:23:37


 > I have a problem linking the following simple program using g++
 > 2.2.2) under SunOS 4.1.2.  None of the curses-related routines are
 > found, and an error message is produced, although everything is in
 > the standard places.  The problem doesn't occur on the RS6000.  On
 > the Sparc, the program is linked using the following command:
 >
 >	g++ -o window window.C -lcurses -ltermcap
 >

Try:

g++ -o window window.C -lg++ -lcurses -ltermcap


-Eric
--
Remember to mail to: 	uunet.uu.net!srg!enewton    "The more you complain,
<or>			enewton@oswego.oswego.edu    the longer God lets you
<or>			enewton@access.digex.com     live."
Newsgroups: comp.lang.c++
From: sakkinen@jyu.fi (Markku Sakkinen)
Subject: Re: Quest: Multiple Virtual functions with same name
Organization: University of Jyvaskyla, Finland
Date: Tue, 10 Nov 1992 10:16:29 GMT

In article <rmartin.721096943@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
>rct@fulcrum.co.uk (Richard Taylor) writes:
>
>|In article <1992Oct30.182516.20463@hplabsz.hpl.hp.com> kalra@PROBLEM_WITH_INEWS_GATEWAY_FILE (Deven Kalra) writes:
>|> ...
>|>I get compiler warnings as:
>|>
>|>	render function hides base function
>
>This is to be expected, members in derived classes "hide" members in
>base classes that have the same name.  See "ARM 13.1"
>|> ...
> ...
>Because it is hidden.  The ARM justifies this with a reasonably
>compelling argument.
> ...
>No, virtualness has nothing to do with it.  The functions would have
>been hidden regardless of whether they were virtual or not.  In the
>example, it would appear that the functions ought to be virtual.
> ...

The explanation was good and exact.
However, I don't find the rationale in the ARM convincing in the least.
This hiding rule causes lots of trouble to the simple use of function
overloading, in trying to prevent some potential (probably rare) bugs.
It's all the more questionable because the general philosophy of C++
indeed is not preoccupied with safety devices for bad or
sloppy programmers.

----------------------------------------------------------------------
Markku Sakkinen (sakkinen@jytko.jyu.fi)
       SAKKINEN@FINJYU.bitnet (alternative network address)
Department of Computer Science and Information Systems
University of Jyvaskyla (a's with umlauts)
PL 35
SF-40351 Jyvaskyla (umlauts again)
Finland
----------------------------------------------------------------------
Newsgroups: comp.lang.c++
From: rkinder@iat.holonet.net (Robert J. Kinder)
Subject: Re: Info on IBM compatible C/C++ compiler needed!
Organization: HoloNet (BBS: 510-704-1058)
Date: Wed, 11 Nov 1992 03:39:14 GMT

On the subject of IBM PC compatible C++ compilers...

Check out the Glockenspiel C++ *preprocessor*, it's a front-end C++
preprocessor for the native C compiler on your local system.  It's
available for VAX, UNIX, OS/2, MS-DOS, and others.  

It's available from ImageSoft in Port Haven, NY.  Call 1-800 directory
assistance.  Ask about CommonView, a portable GUI C++ interface library.

-- 
// rkinder@holonet.net            International Software Solutions, Inc.  -
// Robert J. Kinder, Jr.                             Boca Raton, Florida  -
//                                                        1-800-788-4774  -
//                    "No thanks!  I have a radio."
From: tmb@arolla.idiap.ch (Thomas M. Breuel)
Newsgroups: comp.lang.c++
Subject: Re: Multiple Header Files Problem
Date: 13 Nov 92 00:43:28
Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
	Perceptive)
	<rmartin.721442494@thor> <1drjpsINN1jr@alnitak.usc.edu>
	<rmartin.721531576@thor>
Reply-To: tmb@idiap.ch
NNTP-Posting-Host: arolla.idiap.ch
In-reply-to: rmartin@thor.Rational.COM's message of Thu, 12 Nov 1992 01:26:16 GMT

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

   [example with mutually recursive methods defined inside a class
   deleted]

   This is an excellent example of the dangers of inline functions.  In
   this case, the reason that class a or b cannot be forward declared is
   because of the inline functions.

Please don't start any false rumors: there is nothing "dangerous"
about declaring a function inline (other than that it may be the wrong
space/time tradeoff for your particular application).

   If the inlines are removed, then
   both classes could be forward delcared and the cycle could be broken.

There are no "inlines" to be "removed". If you pull the method
definitions out of the functions, you can still declare them "inline".
Of course, you would have to change your include files around
somewhat.

What I don't understand about the example is why you would even put
mutually dependent classes into separate include files. Some languages
don't even let you define mutually recursive functions in separate
compilation units, and I have not found that to be a problem.

					Thomas.

PS: here is the example:

coller@alnitak.usc.edu (Lee D. Coller) writes:
>
> Actually it doesn't entirely solve the circular dependency problem.
> Consider two files, file a.h containing:
> 
> #ifndef a_h
> #define a_h
> 
> #include "b.h"
> 
> class a {
> public:
> 	b* _b;
> 	void do_b_fnc() { _b->b_fnc(); }
> 	void a_fnc();
> };
> #endif
> 
> File b.h contains:
> 
> #ifndef b_h
> #define b_h
> 
> #include "a.h"
> 
> class b {
> public:
> 	a* _a;
> 	void do_a_fnc() { _a->a_fnc(); }
> 	void b_fnc();
> };
> #endif
Newsgroups: comp.lang.c++
From: kanze@us-es.sel.de (James Kanze)
Subject: Re: Just what is so great about streams?
Organization: SEL
Date: 13 Nov 92 20:04:46


|> This posting is a genuinely answer-seeking question,

|>   what _is_ so great about streams?

I don't really like the syntax for streams either.  In fact, I don't
think many peoply do.

We use them for two main reasons:

1. Type safety:  There's no way you can do something like:
	printf( "%f" , 1 ) ;

2. Extensibility:  How do you expand printf to handle user defined
types.

So we learn to live with the ungainly syntax.

Does anyone know of a better way of handling IO formatting in a
type-safe, extensible manner.  It's too late to change the iostream
syntax, but I am curious as to what the alternatives are.
--
James Kanze			GABI Software, Sarl.
email: kanze@us-es.sel.de	8 rue du Faisan
				67000 Strasbourg
				France
Newsgroups: comp.lang.c++
From: dx@netcom.com (dx)
Subject: Invoking functions passed as parameters
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Tue, 10 Nov 1992 19:27:09 GMT

In standard C, function pointers passed as paramters are invoked with
the standard C syntax, e.g.,

	foo(void (*pf)(parmeters))
	{
		pf(paremeters)
	}

Now suppose I have a class PFCLASS, and pf points to a member function of
this class, and within foo I want to apply the method pointed to by pf to
an instance of PFCLASS, pointed to by pInstance.

In standard C syntax, I would make the member function take the pointer to
the instance as a parameter, and use the standard way to call the function:

	pf(pInstance);

But I wonder if there is some way to invoke the method pointed to by pf
in a more C++ like way, such that pInstance turns up as the 'this' pointer
in the method, rather than having to pass it as a parameter.

Any ideas?

-dx
From: 00mebenbenek@leo.bsuvc.bsu.edu
Newsgroups: comp.lang.c++
Subject: C for Mac
Date: 11 Nov 92 13:42:31 GMT
Organization: Ball State University, Muncie, In - Univ. Computing Svc's

I have a Macintosh Plus (kinda old) that has been upgraded to 4MB RAM.
This computer also has a 50MB harddrive.  I'm getting ready to take a 
C programming class and would like to use my Mac for this...What software
(compiler etc..) do I need in order to do this?  Also is programming in C
 the same for all operating systems?  Any thing that anyone could tell me
 regarding this subject would be greatly appreciated........




								Mike
								@BSU
From: gnk@belar.ECE.ORST.EDU (Giri Rangan)
Newsgroups: comp.lang.c++
Subject: Help needed in a compilation warning
Date: 5 Nov 92 20:04:26 GMT
Organization: none

Help needed urgently. I am compiling some c++ code and I am getting
the following warning.
"temporary used for non const & argument (141)"
I presume the no. 141 means the warning number but I was not able to
find out clear explanation for this warning in the C++ manual that
I have. I am compiling the code on a HP workstation and please tell me 
whether a hardware platform matters for this warning.

I am not able to delete the warning and any help is welcome.
Mail your answer to:
gnk@aldur.ece.orst.edu

Thanks,
Giri.
-- 
=================================================================                       
                        GNK Rangan
Dept of ECE, Oregon State University, Corvallis, OR 97331.
=================================================================
From: schwartz@possum.den.mmc.com (Michael I Schwartz)
Subject: Re: Poll : Microsoft support on the Internet
Organization: Martin Marietta Astronautics, Denver
Distribution: usa
Date: Wed, 11 Nov 1992 14:58:00 GMT

Risking going back to the original thread, I'd like to add kudos for
Microsoft's current support on the Internet.

This has included:
	Material set up at ftp.uu.net covering both new announcements
	and help files and samples of code illustrating specific
	techniques

	Individual Microsoft employees who answer questions and provide
	information until their heads are bitten off by
	politically-savage questioners.

	Individual non-Microsoft employees who have propogated
	Microsoft material from one forum to another (e.g., MSJournal
	code listings).

This is not to say that it wouldn't be great if Microsoft gatewayed the
Compuserve forum to other Internet sites, or that the support is
everything I need:  I do recognize that I get much of what I want
at "reasonable" costs.  I think I've taken opportunities to -um- reduce errors
in future products as well.

No whining here!  Thanks Alistair, and all the demented others who keep
the info flowin.

Michael
-- 
schwartz@pogo.den.mmc.com              "You'll find ... that the only thing 
mschwartz@mmc.com                          you can do easily is be wrong, 
DISCLAIMER:  The opinions expressed are      and that's hardly worth the effort"
not necessarily those of my employer or myself.          --the phantom tollbooth
Newsgroups: comp.lang.c++
From: srheintze@happy.colorado.edu
Subject: Nested Classes vs. Class Specialization
Organization: University of Colorado, Boulder
Date: 11 Nov 92 10:28:16 MDT


There seems to be a great benefit in using nested classes:  less
chance of name space collision.

For example, if we are creating a List class whose implementation consists
of a class for a list head and a link or node class, there is merit to 
embedding or nesting the node class inside the List class.

However, suppose we use template classes.  Suppose we want to do template class
specialization as discussed in Stan Lippman's "C++ Primer" 2nd edition. For a
List class, we probably only want to  specialize the node class.

When experimenting with nested template classes on Borland C++ v3.1, I could
not figure out how to use nested template classes with specialization without
respecifying the entire List class. This, of course, defeats the purpose of
template class specialization.

I therefore conclude that it is impossible to get the best of both worlds.
For non-template classes, we want nested class but for template classes that
might be specialized, we do not want nested classes.

Can someone confirm this observation? Can someone figure out how to do 
template class specialization of a Node class nested inside a List class
without respecifying the entire List Class?

			Thanks,
					Sieg
Newsgroups: comp.lang.c++
From: ort@netcom.com (David Oertel)
Subject: Re: Discriminating Variant Records Without switch() ??
Summary: Re: discrimination variant records without switch()
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Wed, 11 Nov 1992 18:19:13 GMT



>From: bab@se39.wg2.waii.com (Brian Button)
>Since the set of operations is not common, we need to know the type of the
>object before proceeding with processing. Have we painted ourselves
>into a corner? It seems that we need a switch() to do this, but in a
>proper OOP design, it shouldn't be necessary.

	Isn't the proper way to move objects around is to stuff them into an
	OODBMS?  Or is this technology not really there yet?

	ort@netcom.com
-- 
Newsgroups: comp.lang.c++
From: riipinen@dxcern.cern.ch (Petri Juhani Riipinen)
Subject: Borlanc C++ & BGI-graphics.
Organization: CERN European Laboratory for Particle Physics
Date: Mon, 9 Nov 1992 07:57:23 GMT

Hello.

I have (once again...:) a little problem with Borland C++ 3.0. And this time
it very much seems to be a bug in the Borland BGI-graphics library, at least
I can't find anything wrong in my program.

My program is a logic simulator, where you can put gates (and, or, etc...)
on the screen and then connect them with wires and see them working. Well,
it is all done beatifully with objects, of course. And I have the
communication with mouse and the objects with event-system. I did the mouse
system little stupidly, I hooked the after-the-timer (Hmm...0x1C ?)
interrupt and use it to poll the mouse. Now, I know, that it should be
preferably with the automatic mouse interrupts, but I could not get my mouse
interrupts working...:( The program always crashed, when I tried the
automatic mouse handler. This works with the mouse.

For example, when I move one gate, the mouse handler sends a message to that
gate, that it should now move, and it moves. The gate sends messages to all
wires connected to it, that they should also adjust themselves. Nice and
clean...:) Well, after a random time, the lines don't move anymore...:(
And I can't even debug the program, as the whole system crashes, if there is
a breakpoint, while the interrupts are hooked...:( So, I've done little
sound debugging, ie. made some beeps in strategic points in the program,
so that I hear, if the program even executes that code. Well, it does and
it seems, that it calls line(x1,y1,x2,y2) with perfectly legal values.

So, everything else works fine, except the lines wont draw...:( And the
top of rectangles doesn't draw either...

Anybody ever have a similar problem and how did you solve it...?

Greetings,
	    - PJR -
-- 
------------------------------------------------------------------------------
Petri J. Riipinen                (riipinen@dxcern.cern.ch)
Les terrases de Thoiry n.15      (riipin@vxldb1.cern.ch)
01710 Thoiry,  France            (riipin_dev@vxldb2.cern.ch)
Newsgroups: comp.lang.c++
From: adam@dadhb1.ti.com (Adam Hudd)
Subject: LEDA manual in PostScript
Organization: Texas Instruments, Inc., Houston, TX
Date: Fri, 6 Nov 1992 23:09:14 GMT

Please could someone give me the location of an anonymous ftp site that would
have the LEDA manual in PostScript format -- I've been trying to get TeX
compiled on my machine without any success, now that it's Friday afternoon,
I've had enough!

BTW (unfortunatly) we don't have anon ftp enabled here.

Cheers/TIA, Adam
--
Adam Hudd               adam@dadhb1.ti.com             __o
Texas Instruments Inc,                                -\<,
Houston, TX                                     .....O / O
Newsgroups: comp.lang.c++,comp.object,sci.math.num-analysis,sci.math,comp.parallel
From: tob@world.std.com (Tom O Breton)
Subject: Re: operator [][]
Organization: The World Public Access UNIX, Brookline, MA
Date: Mon, 9 Nov 1992 20:09:56 GMT

 

That is one approach to operator[] for multiple arrays. I have another which:

  0:  has the advantage of not requiring intermediate array classes of lesser
      dimensions.

  1:  has the disadvantage of requiring another class.

  2:  has the property of being suited to multiple arrays that always totally
      de-array(?) themselves, and unsuited to arrays that might deal with
      intermediate sub-arrays.

Instead of

  operator[](int index)
 
make this class:

struct indices  //Struct because it's going to be all open.
{ int             index1;
  int             index2;
                  indices(int,int);
};

and use it as the argument:

class MultArray
{ operator[](indices IXs); }

You can call it concisely with:

//MultArray A;
A[indices(x,y)];

        Tom



-- 
The Tom spreads its huge, scaly wings and soars into the wild sky...      
up...       up...     out of sight...   (tob@world.std.com)
Newsgroups: comp.lang.c++
From: cdantoni@abacus.bates.edu (Chuck D'Antonio)
Subject: Linking Scheme code to C++
Organization: Bates College, Lewiston, Maine
Date: Fri, 6 Nov 1992 05:04:13 GMT
Summary: Writing a database, like to use both Scheme and C++, need to know how
Keywords: C++ Scheme Linking Database

I'm about to embark on a database project for my college radio
station.  The majority of code will be in C (using Turbo on a PC), but
I would like to write some of it (querying system for example) in
Scheme.  I'd be using PC Scheme, not quite sure which version.

So how do I link the two?  I profess that I haven't tried to hack it
out yet, I was hoping someone could tell me so I wouldn't have to
worry about it as much.  Thank's in advance.

Chuck
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- WRBC->91.5 FM -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Chuck D'Antonio			      /\    He did it!  Congratulations to  
internet: cdantoni@abacus.bates.edu   \/       _President-elect_ Clinton!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  Apple II Forever -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
From: ezachris@cochiti.ucs.indiana.edu
Newsgroups: comp.lang.c++
Subject: Re: Borland's OWL -- How can I find it?
Date: 13 Nov 92 20:20:27 GMT
Organization: Indiana University

In article <1992Nov13.184913.8177@news.unige.ch> favre@cmurisc1.unige.ch  
(Eric Favre) writes:
> If you want Borland's OWL (and Turbo Vision) you have to buy the
> Borland's Application Frameworks (Borland C++ 3.1 is about $320 and 
> Borland C++ 3.1 w/Appl. Frameworks is about $540)!
 
Or you can buy Turbo C++ 3.1 for Windows - it includes OWL.
With an academic discount it cost me a cool $62.95. 
You get the compiler, OWL, Resource Workshop, debugger,
not to mention Borland's new IDE.


Espen Zachrisen,
Indiana University
"Any technology distinguishable from magic is insufficiently advanced."
Newsgroups: comp.lang.c++
From: emeinfel@gmuvax2.gmu.edu (...)
Subject: C++ Mailing lists
Organization: Ferrous Fencing Ferrets Inc.
Date: Wed, 11 Nov 1992 19:37:30 GMT

I was curious if there are any mailing lists for the discussion of C++
and also does anyone know of any advanced courses in C++ between now and
the end of the year?

Thanks you.
-- 
"Focus on winning and to hell with how you play the game."
#188 Life's Little Destruction Book
Newsgroups: comp.lang.c++
From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
Subject: Simple exception question
Date: Mon, 9 Nov 1992 00:06:15 GMT
Organization: University of Birmingham

I've just read the section in "The C++ Prog.Lang. Edn.2" on exception handling.
I've been using C++ for a while and always found the lack of execption hadling
a bit of a pain. Unfortunately my DOS compiler (Borland) lacks execption
handling, still :-(
 
Can anybody clarify the a few points of which I was left uncertain
 
enum Ex1 { Ex1a, Ex1b };
class Ex2 {};
 
try { throw Ex1a; }  
catch (Ex1& ex) {
  try { throw Ex2(); }
  catch (Ex2) {ex=Ex1b;}
  throw; // What does this throw?
}
 
I hope the answer is Ex1b but from what I've read I'm not sure that it's not
Ex1a or Ex2().
 
Can I throw _any_ type? This would usually be inelegant but not in the case of:
I can imagine
 
int main() {
  try { /* program body */ }
  catch (int exit_status) {return exit_status;}
  return 0;
}
 
Now I can throw an int as an alternative to exit() and get the full
benefit stack unwinding. In fact IMHO main() throwing an int could usefully
be made to behave the same as main() returning an int.
(Yes I do realise I couldn't thow an integer through a firewall unless it
wanted me to, but then functions inside firewalls shouldn't be calling exit())
 
Does anyone know when Borland will release a version with exceptions? (I've
noticed a lot of contributions from borland.com in this group.)
-- 
    \\   ( )  NO BULLSHIT! from BAM (Brian McCauley)
 .  _\\__[oo 
.__/  \\ /\@  E-mail: B.A.McCauley@bham.ac.uk
.  l___\\        Fax: +44 21 625 2175
 # ll  l\\     Snail: 197 Harborne Lane, Birmingham, B29 6SS, UK
###LL  LL\\     ICBM: 52.5N 1.9W