HDTenEightyP/NetNews huggingface dataset:
From: wallyt@cserver.plexus.com (Wally Thomson)
Subject: Linking C++ with C
Summary: Need Help linking C++ to C
Organization: Plexus Corp. -- Neenah Wisconsin
Date: Wed, 18 Nov 1992 14:40:36 GMT

Help!

I am new in the C++ world and just started subscribing to 
this group so please forgive me if this topic was already
discussed.  I need a quick answer about feasibility and means
of linking C++ and C together.  One group is developing
a portion of code in Microsoft C++.  My group wants to 
be able to link this code in with C source compiled on an
HP 9000 system with the HP 80188 cross compiler.

There will potentially be a number of revisions on both
sides of the development so the less painful the conversion
the better.  Is there some kind of filter for Microsoft C++
to convert it to an ANSI C format?  It would not need to be
modified after conversion - just linked with my group's 
code.

Thanks in advance

Wally

--
*                            *                                        *
*  Wally Thomson             *  Software is the difference            *
*  wallyt@cserver.plexus.com *  between hardware and reality.         *
*                            *               - unknown                *
Newsgroups: comp.lang.c++
From: pat@frumious.uucp (Patrick Smith)
Subject: Re: comp.lang.c++
Date: Wed, 18 Nov 1992 03:04:15 GMT
Reply-To: uunet.ca!frumious!pat
Organization: None

mat@mole-end.matawan.nj.us writes:
|In article <1992Nov13.193122.8662@dorsai.com>, head@dorsai.com (Howard Pinsley) writes:
|
|> rog@hpscit.sc.hp.com (Roger Haaheim) writes:
|> : In comp.lang.c++, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
|
|> : > 	It might be appropriate to have a comp.newuser.c++
|> :                                           ^^^^^^^^^^^^^^^^
|> Why split it up?  If newuser-type questions go in a different conference, they
|> might not get the benefit of replies from more experienced c++ programmers who
|> might avoid such a conference.  Let's stay together.
|
|As much as I want to encourage and help new people, I also need a newsgroup
|where I can bounce harder questions off people.  Discussing a subtelty of
|overload resolution isn't in the same league as telling someone to put
|an  extern "C" int f();  in his program.
|
|At the very least, I would like to see `environment' stuff (how to compile,
|how to link) off in a seperate newsgroup.  And a RTFF (`Read the Funky FAQ')
|newsgroup wouldn't hurt (excepting the pain of the people sent there).

If we decided to pursue this goal, it might be better to put the
subtle discussions in the new group, since comp.lang.c++ is where
people would naturally turn with their questions (of any level of
difficulty) about C++.  The new group might be called
comp.lang.c++.pedantry or some such.  (comp.unix.wizards might be
the model to follow, but perhaps with a less stringent meaning
of "wizard".)

-- 
Patrick Smith
uunet.ca!frumious!pat
pat%frumious.uucp@uunet.ca
From: njs@planet.bt.co.uk
Newsgroups: comp.lang.c++
Subject: Re: Re: comp.lang.c++
Date: 17 Nov 92 12:09:35 GMT
Organization: DNM42, BT Labs, Martlesham Heath, Ipswich, UK.
Originator: njs@andromeda


In article <46960010@hpscit.sc.hp.com>, rog@hpscit.sc.hp.com (Roger Haaheim) writes:
|> In comp.lang.c++, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
|> 
|> > 	It might be appropriate to have a comp.newuser.c++
|>                                           ^^^^^^^^^^^^^^^^
|> 
|> I'll vote for it.

Makes sense.

Nathan
From: may@Apple.COM (Patrick May)
Newsgroups: comp.lang.c++
Subject: Re: New Employee Test
Date: 24 Nov 92 01:59:12 GMT
Organization: Apple Computer Inc., Cupertino, CA

In article <1992Nov21.112718@IASTATE.EDU> kv07@IASTATE.EDU (Warren Vonroeschlaub) writes:
>In article <641@ulogic.UUCP>, hartman@ulogic.UUCP (Richard M. Hartman) writes:
>> A portfolio, by it's very nature, shows the candidate only
>> at his/her best.
>> 
>> A "pop quiz" is a better measure of what they are capable of
>> under "real world" conditions.
>
>  I thought I would mention that, at least it in New York, it is illegal to give
>a test to prospective employees before hiring them.

     I shudder to ask, but what possible justification is there for this
law and what government agency enforces it?

Regards,

Patrick May
may@apple.com
------------------------------------------------------------------------
                              "A contract programmer is always intense."
Newsgroups: comp.lang.c++
From: sakkinen@jyu.fi (Markku Sakkinen)
Subject: Re: Member function renaming proposal from the ARM
Organization: University of Jyvaskyla, Finland
Date: Tue, 17 Nov 1992 10:37:35 GMT

In article <721945900snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk writes:
>I have a question about an extension to the language to allow programmers 
>to specify inheriting and optionally renaming functions. The extension is 
>proposed in the ARM 10.11c (pp 236-237). 
>
>Let us assume two base classes with name clashes ...
> ...
>// The suggested extension would allow ...
>class LotterySimulation : public Lottery, public GraphicalObject {
>	// ...
>	virtual int l_draw() = Lottery::draw;
>	virtual void draw() = GraphicalObject::draw;
>	};
>
>It is stated in the ARM that such a language extension is not _necessary_,
>and is only worthwhile if the need to resolve such name clashes proves 
>common. It strikes me that the workround suggested in the ARM is going to 
>cause some loss of efficiency on most compilers around today.

I will take some ideas from my paper in Computing Systems
(A critique of the inheritance principles of C++) -- excuse the plug.
The ARM is actually wrong:  some extension like this would be necessary
in order to _redefine_ the two 'draw' functions separately.
At least Eiffel has the 'rename' clause for this purpose.

>I see another use for this extension (see ARM also 13.1 pp310-312) ...
> ...
>class Derived {
              ^^ : public Base  (obviously)
>public:
>	// ...
>	void set(int) = Base::set(int);
>	void set(double) = Base::set(double);
>	virtual void set(char *s);
>	};
>
>This will prevent set(int) and set(double) being hidden by set(char *), 
>without any loss of efficiency in the calling mechanism.
> ...

I suggested an even more convenient way for inhibiting the obnoxious
hiding rule in the paper:
	reveal set;
I.e., none of the overloaded 'set' functions would be hidden.
Even better if the hiding would not be the default, but could
be effected when desired by
	hide set;

In both cases, I think that conceptual clarity is a stronger argument
than efficiency for the proposed language modifications.

----------------------------------------------------------------------
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: koch@eis.cs.tu-bs.de (Andreas Koch)
Subject: CenterLine / Lucid addresses?
Organization: TU Braunschweig,Informatik,EIS,West Germany
Date: Mon, 16 Nov 1992 09:42:29 GMT

Does anyone know the e-/snail- mail addresses of CenterLine
and Lucid? I would like to get further info on their
ObjectCenter and Energize C++ programming environments.

Thanks in advance,
	Andreas Koch
Newsgroups: comp.lang.c++
From: hansen@deci.cs.umn.edu (David M. Hansen)
Subject: Re: Is Ctor X() required for the object of class X to be able to be dynamically allocated?
Keywords: constructor X(), dynamic allocation
Organization: University of Minnesota
Date: Fri, 20 Nov 1992 18:47:07 GMT

In article <1992Nov20.080626.9582@netcom.com>, ort@netcom.com (David Oertel) writes:
|> 
|> 	This is wrong, the compiler should automatically generate the 
|> 	default constructor as well as the copy constructor, the assignment
|> 	operator, and the address-of operators, if you don't explicitly
|> 	specify them.

From the ARM, section 12.1, p. 264: "A default constructor will be generated 
for a class X only if no constructor has been declared for class X.

So, the default ctor will not be generated if you declare a constructor that
requires one or more parameters. 

					-=Dave
Newsgroups: cvnet.c++,comp.lang.c++
From: bosnes@boeygen.nr.no (Vidar Bosnes)
Subject: Re: Finding memory leaks
Keywords: OOP,memory leaks
Organization: Norsk Regnesentral (NR) 
Date: Sat, 21 Nov 1992 14:53:21 GMT

Mike Kirby (mpk9172@ultb.isc.rit.edu) writes:
>   I would like to do the same kind of thing in C++.  Unfortunately, it
>   seems that new is not as easy to #define over as malloc.  I thought
>   (briefly) that I could do something like #define new new(__LINE__,__FILE__) 
>   and then overload the new operator, but this causes a recursive macro.

There should be no problem in using the macro you suggested. The ARM
(chap 16.3.3), Preprocessing; rescanning and further replacement, reads:

   After all parameters in the replacement list have been replaced, the
   resulting list is rescanned for more macros to replace. If the name
   of the macro being replaced is found during this scan or during
   subsequent rescanning, it is not replaced.

Thus, there is no recursion involved. I have used this technique
successfully with g++ and dec-cxx. If you use g++, note that this
compiler uses non-standard syntax for the call to the overloaded
new-operator (curly braces instead of parentheses).
From: cshaver@informix.com (Craig Shaver)
Newsgroups: comp.lang.c++
Subject: Re: Should I use a generic object which all others inherit from
Date: 20 Nov 92 23:42:58 GMT
Organization: Informix Software, Inc.

In article <5242@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
>: .......   blah blah blah
>: 
>: YourObject is worthless, just use MyObject....
>
>Yes, but from my point of view... (:-)
>
Let me think this about that ......
>
>: ........  blah blah blah
>: >Once a reference to an object has been passed as a generic
>: >object reference, for example into a collection, how do you (safely)
>: >call the actual methods of the objects (derived) class?
>
>You didn't answer on that one...
>
Looked obvious to me!  Close your eyes and hope for the best.
The base class should have something for " Not Implemented Here " or
!No Habla Espanol!  to catch that.  This is a problem with all
static lingo's; no fallback or easy way to back out of the stack.
Just go BOOM!!!

I don't think this is a big show stopper.  Similar to array bounds
checking.

>-- 
>--------------------------------------------------------------------------
>| Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
>| Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
>--------------------------------------------------------------------------

Kraig at Korporate Kontrol
-- 
Craig Shaver  (cshaver@informix.com for now) (415)390-0654 (415)926-6407
Productivity Group POB 60458 Sunnyvale, CA  94088
Newsgroups: comp.lang.c++
From: reindorf@us-es.sel.de (Charles Reindorf)
Subject: Re: Does anyone understand this quirk?
Organization: SEL-Alcatel Line Transmission Systems Dept. US/ES
Date: Tue, 17 Nov 92 11:56:30 GMT

In article <1992Nov17.073603.5235@murdoch.acc.Virginia.EDU>, rad2r@uvacs.cs.Virginia.EDU (Robert DeLine) writes:
|> 
|> For your amusement, please consider the following little program:
|> 
|> 
|>      #include <iostream.h>
|>      
|>      class A
|>      {
|>        public:
|>          A ()  { this->id(); }
|>          virtual void id () const {  cout << "A\n"; } 
|>      };
|>      
|>      
|>      class B : public A
|>      {
|>        public:
|>          B () : A() { }
|>          virtual void id () const {  cout << "B\n"; }
|>      };
|>      
|>      
|>      main ()
|>      {
|>          B* bptr = new B();
|>      }
|> 
|> 
|> 
|> The output I get from three different compilers is "A", but I was
|> expecting to see "B".  Does a virtual function not become virtual till
|> after the constructor is done?  What gives?  Is it my compilers or is
|> this a bug in the language definition itself?  (Or is it just me? :)
|> 

This is not a bug, it is one aspect of the C++ language specification, which states
that the member functions (virtual or otherwise) called from within the constructor 
or destructor of a class are those defined in the class or in it's base classes but
*not* those defined in any derived classes, even if overridden. This is an attempt
to steer clear of accesses to unconstructed (or recently destructed) parts of the
derived class. The ARM section 12.7 specifies this.

|> Many thanks,
|> 
|> Rob DeLine
|> Computer Science, University of Virginia
|> deline@Virginia.EDU

All opinions here are my own etc.
Charles Reindorf
Newsgroups: comp.lang.c++
From: d91-jda@oddjob.nada.kth.se (Johan Danielsson)
Subject: Re: Idempotent header file proposal
Organization: Royal Institute of Technology, Stockholm, Sweden
Distribution: comp
Date: Fri, 20 Nov 1992 12:50:39 GMT

I think there is (were?) something called #import in Objective-C that
only includes the file once.

--

| d91-jda@nada.kth.se   | Everything's cool and froody.
| Johan Danielsson      |
From: hosken@spss.com (Bill Hosken)
Newsgroups: comp.lang.c++
Subject: Re: self-reproducing C++ program
Date: 18 Nov 92 20:14:34 GMT
Organization: SPSS, Inc.

In article <c164-aa.722076580@po.berkeley.edu>, c164-aa@po.berkeley.edu (Paul DuBois) writes:
> dechc00@tohi.DMI.USherb.Ca (CHRISTIAN DECHAMPLAIN) writes:
> 
> >Is that an undecidable problem.  The type of problem you waiste your life
> >trying to solve only to finaly discover it is undecidable.
> 
> I think not -- assuming a self-reproducing program of finite size exists,
> one can surely generate all possible inputs to a compiler of equal
> or lesser size.  If an input compiles (!), testing for self-reproduction
> is easy (diff).
> 
> An example has been given, therefore the assumption is valid.  QED.
> --
> Paul DuBois				    Permanent: pld@soda.berkeley.edu
>   If you call this a short .sig, you oppose its reality.  If you do not call
>   it a short .sig, you ignore the fact.  Now what do you wish to call this?


Right, but still, the problem of finding the 'shortest program to do x'
is a very hard one for almost any task x.  The exhaustive method above is
clearly impractical except where the known program is very small indeed.

I don't think there are very big prizes for finding these shortest programs
either.
From: aking@trees.az05.bull.com (Andy King)
Newsgroups: comp.lang.c++
Subject: Implementing a 'message' class
Date: 18 Nov 92 16:32:32 GMT
Reply-To: aking@trees.az05.bull.com (Andy King)
Organization: Bull HN Information Systems Inc., Phoenix Product Division

In C, it is relatively simple to create a facility for displaying
messages which contain arbitrary data and data types.  For example,
I usually define a library function with a prototype similar to:

    void display_message(char* format, ...);

and then use variable argument processing to create a message
string.  This message can then be displayed to the user (in a
Motif dialog or Windows MessageBox, for example) and also written
to a log file.

I'd like to do the equivalent using the '<<' operator in C++, but
I can't figure out how to implement the operator function.  I
envision the use of this class as follows:

    display_class display("logfile"); // an instance of the message class

    display << "Error opening " << file_name << " Status: " << errno;

The '<<' operator in 'display_class' would put this message into a
dialog box and write it to "logfile".  It would also display the
dialog and wait for the user to click on the "OK" button.

Obviously, I can derive the 'display_class' from 'ofstream', and
send all messages to a file.  But I need to 'capture' the stream
and manipulate it before it goes anywhere.  Another solution would be
to use 'strstream' as the base class for 'display_class', and to
implement a member function which does the actual dispatching of the
message.  For example, after every message, the program would call:

    display.out();

which would take the most recent message and send it to the screen
and to a log file.  But this seems as though it shouldn't be
necessary.  Of course, I could overload 'operator<<' for every type,
but this is laborious, and would preclude the use of an existing
'ostream' based '<<' for user-defined types.

Can this be done?  How is the 'endl' specifier implemented in the
'ostream' class?  Would it be possible to implement a similar facility,
requiring that the programmer terminate a message with a class-defined
specifier, thus activating the output processing?

I'd really appreciate any suggestions.  I'll post a summary, if
appropriate.

Thanks,

Andy

aking@trees.az05.bull.com
Newsgroups: comp.lang.c++
From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
Subject: Re: How to run destructors of all objects when failure exit occurs ?
Date: Mon, 16 Nov 1992 13:18:39 GMT
Organization: University of Birmingham

In article <BxsFJE.6GL@news.cso.uiuc.edu>, pl2440@meibm31.cen.uiuc.edu (Paul Jay Lucas) writes:
> In <AAAsb0h8xN@inpbox.inp.nsk.su> dolgov@inpbox.inp.nsk.su (Yuri V. Dolgov) writes:
> 
>>   Often I use failure program exit when some conditions are bad.
>>The trouble is: I created some objects (e.g. dialog boxes, network connections
>>and so on) and I want to run destructors before program exit.
>>Is there exist standard technique in C++ language to solve this problem ?
> 
> 	No; only statically-allocated objects are destroyed.  Off the
> 	top of my head, *a* way to have auto-objects destroyed would be
> 	to make them register themselves with some global list of
> 	objects on construction and deregister themselves on
> 	destruction.  Now, when the global "clean-up" object gets
> 	destroyed, it could destroy all objects that are still
> 	registered.
> 
> 	Actually, they can't be auto objects, but must instead be
> 	dynamically-allocated objects; it is illegal to delete anything
> 	not allocated by new (as auto objects aren't).
If you use exception handling rather than exit() then all your `auto's are
destroyed neatly. To get rid of dynamics either have a global list (as above)
or if you prefer an abitary number of `auto' "clean-up" objects each of
which cleans up objects in a given scope. See the section in "The C++
Prog.Lang.Edn.2" on exceptions for some examples of this.

#define exit(i) throw int(i)
int main() { try {/* program body */} catch (int retval) { return retval; } }

Actually I wouldn't `#define exit' in reality but it shows the idea

If, like me, your compiler does not yet have exception handling :-( then lobby
your compiler implementor.
-- 
    \\   ( )    No Bullshit!     |  Email: B.A.McCauley@bham.ac.uk   
 .  _\\__[oo        from         |  Voice: +44 21 471 3789 (home)
.__/  \\ /\@    /~)  /~[   /\/[  |    Fax: +44 21 625 2175 (work)
.  l___\\      /~~) /~~[  /   [  |  Snail: 197 Harborne Lane,
 # ll  l\\    ~~~~ ~   ~ ~    ~  |         Birmingham, B29 6SS, UK
###LL  LL\\   (Brian McCauley)   |   ICBM: 52.5N 1.9W
Newsgroups: comp.lang.c++,gnu.g++.help
From: lenard@mullian.ee.mu.OZ.AU (rohan james lenard)
Subject: Template question with g++/gcc (again)
Summary: Need advise on a template question with g++/gcc
Organization: Computer Science, University of Melbourne, Australia
Date: Tue, 17 Nov 1992 19:20:48 GMT

Whoops I made a mistake in my last post regarding templates under g++/gcc.
Here is a repost with the correction made (and hightlighted) -

I have a question regarding template and g++/gcc.
According to the ARM something like this should be valid -

>	template<class T,char *V> class foo : public T
					    ^^^^^^^^^^
>	{
>		foo(char *filename = V) {} ;
>	}
...
>	foo<int,"Hello">	a;

However g++/gcc (2.2.2) complains pretty mightily about it.
I have tried something like this -

>	class A
>	{
>		const char *str = "Hello";
>		operator char * () const { return str; }
>	}
>	template<class T,class V> class foo : public T
					    ^^^^^^^^^^
>	{
>		foo(char *filename = (char *)V) {} ;
>	}
>
>	foo<int,A>		a;

and it can be made to work, but it is not as elegant.

Does anyone have a work around so that I can use something like the first
example ? (NOTE: I may not have my code syntactically correct, as I am trying
to remember it from a few days ago at a friends work, but I assume you get the
idea)

Any help would be appreciated.

As an aside (sp?), the examples in the ARM for this sort of template class
both work - did GNU only use these or what :-) ?


Thanks in advance,
Regards,
	Rohan
--------------------------------------------------------------------------
lenard@munagin.ee.mu.OZ.AU			O O
lenard@mundil.cs.mu.OZ.AU			 |
lenard@ecr.mu.OZ.AU				\_/
--
Rohan Lenard
lenard@munagin.ee.mu.OZ.AU
lenard@mundil.cs.mu.OZ.AU
lenard@ecr.mu.OZ.AU
Newsgroups: comp.lang.c++
From: c164-aa@po.berkeley.edu (Paul DuBois)
Subject: Re: self-reproducing C++ program
Organization: University of California, at Berkeley
Date: Wed, 18 Nov 1992 08:49:40 GMT

dechc00@tohi.DMI.USherb.Ca (CHRISTIAN DECHAMPLAIN) writes:

>Is that an undecidable problem.  The type of problem you waiste your life
>trying to solve only to finaly discover it is undecidable.

I think not -- assuming a self-reproducing program of finite size exists,
one can surely generate all possible inputs to a compiler of equal
or lesser size.  If an input compiles (!), testing for self-reproduction
is easy (diff).

An example has been given, therefore the assumption is valid.  QED.
--
Paul DuBois				    Permanent: pld@soda.berkeley.edu
  If you call this a short .sig, you oppose its reality.  If you do not call
  it a short .sig, you ignore the fact.  Now what do you wish to call this?
Newsgroups: comp.lang.c++
From: sjm@bcrki65.bnr.ca (Stuart MacMartin)
Subject: Re: New Employee Test
Organization: Bell-Northern Research Ltd., Ottawa, Canada
Date: Tue, 17 Nov 1992 19:11:33 GMT

In article <assist.721943530@orion.oac.uci.edu> assist@orion.oac.uci.edu (ASSIST Coordination Site) writes:
>
>Hi everyone,
>
>i am in the process of hiring 2 C++ programmers.  This Wednesday 11/18/92
>we are cunducting the final interviews with 4 candidates.
>
>
>I have a C++ question I would like them to address (sort of a programming test, but not really) but I'm not sure if it's too simple or too complex.
>
  [test example deleted]

>I could really use some feedback on what you think about asking this type of question to determine whether someone really knows C++ or whether the've just read some books.
>
>Any other suggestions for what to do during these interviews would be greatly appreciated.             

This might be instructive, but I'm not sure of your motives.

1.  I know the answer, and I've only read some books (and taken
    a C++ course).

2.  Do you want someone who is a syntactic wizard, someone who understands the
    pitfalls, someone good at finding problems with C++ code without using any
    debugging tools, or someone who understands OO design and programming?
    It seems clear to me that you already have someone who understands how to
    construct a class in C++.  Knowledge of OO is much more crucial to success,
    if you plan to use C++ as anything other than a better C, isn't that what
    you need to test?

3.  You won't be able to find someone who can program immediately in C++ anyway,
    because (s)he will have to learn your class libraries, style guidelines, and
    applications first anyway.

Stuart
--
: Stuart MacMartin                                    email: sjm@bnr.ca      :
: Bell-Northern Research                              phone: (613) 763-5625  :
: PO Box 3511, Stn C, Ottawa, K1Y-4H7, CANADA    Standard disclaimers apply. :