Hi,
My question is.. if Lisp, a 40 year old language supports garbage
collection, why didn't the authors of C++ choose garbage collection for
this language? Are there fundamental reasons behind this? Is it because
C is generally a 'low level' language and they didn't want garbage
collection to creep into C++ and ruin everything?
Just wondering :)
Rick 11 2755
Rick wrote: Hi,
My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language?
You have to ask Mr. Stroustroup on this one.
He has written a book about why C++ looks and acts the way it does.
Locate his website, I think there is a description of that book.
Are there fundamental reasons behind this? Is it because C is generally a 'low level' language and they didn't want garbage collection to creep into C++ and ruin everything?
Ts, ts, ruin everything.
But it's true. C and C++ is used a lot controlling software.
Imagine a nuclear power plant. Imagine that there is a malfunction
within the reactor. Further imagine that your software has detected
that malfunction and is going to shut down the reactor in an orderly
fashion. The software has waited until there is no other choice to
shutdown and it knows that this may be time critical. The software
starts the shutdown process .... and then the garbage collector kicks in.
That said: C++ is powerful enough that there are garbage collectors around.
Just google for them if you feel the need to use one.
--
Karl Heinz Buchegger kb******@gascad .at
On Fri, 05 Dec 2003 02:06:54 +1100, Rick <rrquick@nosp am-com> wrote: Hi,
My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language? Are there fundamental reasons behind this? Is it because C is generally a 'low level' language and they didn't want garbage collection to creep into C++ and ruin everything?
Just wondering :)
Rick
I, for one, don't want anything to do with GC, thanks! The day C++
forces GC on me, I'll move on to Assembler if I have to.
Rick <rrquick@nosp am-com> wrote in message news:<3f******* *@clarion.carno .net.au>... Hi,
My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language? Are there fundamental reasons behind this? Is it because C is generally a 'low level' language and they didn't want garbage collection to creep into C++ and ruin everything?
Just wondering :)
Rick
Why don't you ask Dr Bjarne Stroustrup :) http://www.research.att.com/~bs/bs_f...age-collection
"Dan W." <da**@raytron-controls.com> wrote in message
news:e0******** *************** *********@4ax.c om... On Fri, 05 Dec 2003 02:06:54 +1100, Rick <rrquick@nosp am-com> wrote:
Hi,
My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language? Are there fundamental reasons behind this? Is it because C is generally a 'low level' language and they didn't want garbage collection to creep into C++ and ruin everything?
Just wondering :)
Rick
I, for one, don't want anything to do with GC, thanks! The day C++ forces GC on me, I'll move on to Assembler if I have to.
Amen, brother!
Karl Heinz Buchegger wrote:
<snip> Imagine that there is a malfunction within the reactor. Further imagine that your software has detected that malfunction and is going to shut down the reactor in an orderly fashion. The software has waited until there is no other choice to shutdown and it knows that this may be time critical. The software starts the shutdown process .... and then the garbage collector kicks in.
<snip>
This actually describes a need for a hard real-time OS. GC and
real-time are not inherently incompatible (there are real-time JVMs out
there), and not having GC is obviously not sufficient to ensure meeting
deadlines.
I understand the point you're making, Karl. I'm just picking on your
example. Real-time doesn't mean 'real fast', it just means 'real
predictable'.
Suffice it to say that GC will eat cycles, and if C++ were to provide GC
in the same manner as Java, then there would be no way to avoid spending
time doing garbage collection in a C++ application.
- Adam
--
Reverse domain name to reply.
"Rick" <rrquick@nosp am-com> wrote: My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language? Are there fundamental reasons behind this? Is it because C is generally a 'low level' language and they didn't want garbage collection to creep into C++ and ruin everything?
I guess the principle is not to take decisions about things like memory
management out of the programmer's hands ... C++ was designed to stay pretty
much as efficient as C. There is also a principle of "extensibil ity via
libraries" instead of adding features to the language (if you want a garbage
collector, you can always add one; the "new" operator was made overloadable
so that memory management could be done however you like). The disadvantage
is that some things would be much easier to use if they were built into the
language, eg. a "for each ..." statement (with a local body that allows
break & continue), a completely polymorphic type (like the "any" type in the
boost library), and (optional) garbage collection.
Here are some web pages related to garbage collection in C++: http://www.hpl.hp.com/personal/Hans_Boehm/gc/index.html
(lots of garbage collection resources) http://www.jelovic.com/articles/cpp_...ors_slides.htm
(a "safe pointer" type)
- neither of which I have actually tried, but they look good ...
I also read about a library which lets you group a set of objects together
and free them all at once (much faster than one at a time), but I can't find
it right now. Has anyone else heard of this library ?
David F
---
"I saw 'cout' being shifted "Hello world" times to the left and stopped
right there."
- Steve Gonedes
Thanks David,
David Fisher wrote: I also read about a library which lets you group a set of objects together and free them all at once (much faster than one at a time), but I can't find it right now. Has anyone else heard of this library ?
Yup.. this is what "region-based memory management" is all about - first
introduced by Tofte and Talpin.
regards,
Rick
"Xenos" <do**********@s pamhate.com> wrote in message news:<bq******* **@cui1.lmms.lm co.com>... "Dan W." <da**@raytron-controls.com> wrote in message news:e0******** *************** *********@4ax.c om... I, for one, don't want anything to do with GC, thanks! The day C++ forces GC on me, I'll move on to Assembler if I have to.
Amen, brother!
Amen ^ 3.
GC is the concept of mopping the floor and putting the dirt under the carpet.
Furthermore, today, with all the great tools like valgrind, you can
detect all memory related bugs with a couple of good testcases.
Stelios
"Rick" <rrquick@nosp am-com> wrote: My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language?
I just came across this article on the "D" language, which includes garbage
collection ... http://www.cuj.com/documents/s=8254/...86243774/d.pdf
David F This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bob |
last post by:
Are there any known applications out there used to test the performance of the .NET garbage collector over a long period of time? Basically I need an application that creates objects, uses them, and then throws them away and then monitors the garbage collection and store statistics on it, preferably in C#. I want to know what is the longest period of time that an application may lock up while garbage collection is processing. Thanks!
|
by: Ganesh |
last post by:
Is there a utility by microsoft (or anyone) to force garbage collection in a
process without have access to the process code.
regards
Ganesh
|
by: Ville Voipio |
last post by:
I would need to make some high-reliability software
running on Linux in an embedded system. Performance
(or lack of it) is not an issue, reliability is.
The piece of software is rather simple, probably a
few hundred lines of code in Python. There is a need
to interact with network using the socket module,
and then probably a need to do something hardware-
related which will get its own driver written in
C.
|
by: Bob lazarchik |
last post by:
Hello:
We are considering developing a time critical system in C#. Our tool used in
Semiconductor production and we need to be able to take meaurements at
precise 10.0 ms intervals( 1000 measurement exactly 10 ms apart. In the
future this may decrease to 5ms ). I am concerned that if garbage
collection invokes during this time it may interfere with our measurement
results. I have looked over the garbage collection mechanism and see no...
|
by: mike2036 |
last post by:
For some reason it appears that garbage collection is releasing an object
that I'm still using. The object is declared in a module and instantiated
within a class that is in turn instantiated by the mainline. The class that
instantiated the object in question is definitely still in existence at the
point garbage collection swoops in and yanks it out from under my processing.
Is there a way to ensure an instantiated object cannot be freed...
| |
by: Goalie_Ca |
last post by:
I have been reading (or at least googling) about the potential addition
of optional garbage collection to C++0x. There are numerous myths and
whatnot with very little detailed information.
Will this work be library based or language based and will it be based
on that of managed C++? Then of course there are the finer technical
questions raised (especially due to pointer abuse). Is a GC for C++
just a pipe dream or is there a lot of work...
|
by: Johnny E. Jensen |
last post by:
Hellow
I'am not sure what to think about the Garbage Collector.
I have a Class OutlookObject, It have two private variables.
Private Microsoft.Office.Interop.Outlook.Application _Application = null;
Private Microsoft.Office.Interop.Outlook.NameSpace _Namespace = null;
The Constructor:
public OutlookObject()
|
by: Lloyd Bonafide |
last post by:
I followed a link to James Kanze's web site in another thread and was
surprised to read this comment by a link to a GC:
"I can't imagine writing C++ without it"
How many of you c.l.c++'ers use one, and in what percentage of your
projects is one used? I have never used one in personal or professional
C++ programming. Am I a holdover to days gone by?
|
by: pushpakulkar |
last post by:
Hi all,
Is garbage collection possible in C++. It doesn't come as part of
language support. Is there any specific reason for the same due to the
way the language is designed. Or it is discouraged due to
some specific reason. If someone can give inputs on the same, it will
be of great help.
Regards,
Pushpa
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |