C++ with automatic garbage collection = C#
-
Christian Graus wrote:
Yes, you can add those, I'm talking core language here.
this always annoys me (not you, this). IMO, the "core language" is the syntax and grammar. something that you write using that grammar and ship with the compiler isn't part of the language, it's an external library. ex., RegEx support in C# is something someone wrote using C# (or some other .Net language, or something that can be called from C#) - it's not something that's intrinsic to C# any more than RegEx is intrisic to C++. just because MS ships their C# compiler with all these wonderful classes doesn't make C# the language better - it just makes MS's C# package better. yes, yes, i know standards bodies can say that X,Y and Z are part of the language. but that's nonsense. it's like saying the C# specification is part of the official English language, and that makes English a better language than some equally-expressive spoken language into which the C# spec hasn't been translated. the C# spec is the C# spec, regardless of the language used to describe it, and no language will ever be created of which the C# spec is considered an integral part. in other words: you can't measure the quality of a language in terms of things that have been written in that language, you can only measure it in terms of things that can be written in that language, and the language is the syntax and grammar. GC is part of C# the same way vtables are part of C++. RegEx is an add-on in both. yes, i know that's not the official CS point of view. /rant
Chris Losinger wrote:
this always annoys me (not you, this)
:omg: But but but what would you do without the
this
pointer?
Hope is the negation of reality - Raistlin Majere
-
deostroll wrote:
C++ with automatic garbage collection = C#
Next version of C++ standard comes with garbage collector. :cool:
Hope is the negation of reality - Raistlin Majere
Ehhhhxcellent... :cool:
-
That's plain sad.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Well, it's optional. AFAIK, you'll have to place a modifier to the class, so only those classes' instances will be collected.
Hope is the negation of reality - Raistlin Majere
-
If my switch code was that complex, I'd have the switch call a method, which returned true or false, and use that return value to break or continue.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Could also put the
while
in a method andreturn
from theswitch
. Lots of ways to do it, various levels of cleanliness. -
Well, it's optional. AFAIK, you'll have to place a modifier to the class, so only those classes' instances will be collected.
Hope is the negation of reality - Raistlin Majere
Either way, what's the point of having different languages, that are all the same ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Could also put the
while
in a method andreturn
from theswitch
. Lots of ways to do it, various levels of cleanliness.Sure - core issue is to refactor so a switch doesn't contan buckets of code. You should definately be able to easily see all the cases. And, I like to refactor code anyhow, to make for smaller, simpler methods.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Chris Losinger wrote:
GC is part of C#
No, it's part of .net. -- modified at 23:17 Thursday 4th October, 2007 the common language runtime (CLR)'s garbage collector http://msdn2.microsoft.com/en-us/library/ms973837.aspx[^]
PIEBALDconsult wrote:
No, it's part of .net.
Yeah but in a future version of the .NET framework, if it was a configurable option to turn off the GC (say via a GC::ShutDown() method), I am sure this wouldn't be a practical option for C#. Since C# does not have a syntactic equivalent of the C++ delete. You'd have to end up doing something weird like GCHandle::Delete(object) which would kill off C# popularity. So while GC is a part of .NET, people will always associate it with C#.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
Either way, what's the point of having different languages, that are all the same ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Good point. But I believe that is more like taking good things from other languages, as long as they do not get in the way of the main language's goals. But yeah, I understand your point --and kinda agree with you.
Hope is the negation of reality - Raistlin Majere
-
What is the real difference, you ask? It is there in the title itself. Plus you may argue that c# is more typesafe and stuff; avoids any usually complex pointer logic; avoids pointers totally...yada yada yada... To me it is just the way c# language compiler was designed. When you come down to the compiler level you have to de-initialize an object and clear memory. No other way to do this. It may be a mammoth task in c++, but it is possible. Everything is possible. Those who say something is impossible are probably out of ideas (or lack of sample code maybe :confused:). Given indefinite time I believe developing applications in c++ would result in robust applications. However what most programmers do today is charge into the arena like a bull! I'd rather like to plan my path. And a piece of paper and a pen that writes is always a good start. I wonder who the hell said: time is money. I'd want to throw my pc at him, and say thankyou very much! It is what people are asking for. It is our society. Most of the time when customers ask developers to do something, they completely drop the ethical sense. The result of this is that you are being pressurized, unnecessarily; or worse the customers themselves pressurizing you, unnecessarily! For if it was the opposite case (i.e. the customers had this ethical knowledge) and they kept pressurizing you, there would at least be some sort of justice/sense in that! (You being nailed to the wall here is not the point). --deostroll
deos**troll**
What else do you want from the guy?
:badger:
-
deostroll wrote:
C++ with automatic garbage collection = C#
Next version of C++ standard comes with garbage collector. :cool:
Hope is the negation of reality - Raistlin Majere
I wonder how long it would take till the first Service Pack that fixes the memory leak in the GC for C++?
:badger:
-
deos**troll**
What else do you want from the guy?
:badger:
Well yes, but if he's God's own troll...
-
PIEBALDconsult wrote:
No, it's part of .net.
Yeah but in a future version of the .NET framework, if it was a configurable option to turn off the GC (say via a GC::ShutDown() method), I am sure this wouldn't be a practical option for C#. Since C# does not have a syntactic equivalent of the C++ delete. You'd have to end up doing something weird like GCHandle::Delete(object) which would kill off C# popularity. So while GC is a part of .NET, people will always associate it with C#.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linkNishant Sivakumar wrote:
people will always associate it with C#
... and perpetuate the misconception, I'm trying to clear the air. It's a windmill; I shall tilt at it.
-
I wonder how long it would take till the first Service Pack that fixes the memory leak in the GC for C++?
:badger:
Well, that'll depend on the compiler for C++, not the language itself.
Hope is the negation of reality - Raistlin Majere
-
Well, that'll depend on the compiler for C++, not the language itself.
Hope is the negation of reality - Raistlin Majere
Well yeah. But what I meant is that the GC will most probably have a memory leak of its own.
:badger:
-
Sure - core issue is to refactor so a switch doesn't contan buckets of code. You should definately be able to easily see all the cases. And, I like to refactor code anyhow, to make for smaller, simpler methods.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
goto. *runs*
-
What is the real difference, you ask? It is there in the title itself. Plus you may argue that c# is more typesafe and stuff; avoids any usually complex pointer logic; avoids pointers totally...yada yada yada... To me it is just the way c# language compiler was designed. When you come down to the compiler level you have to de-initialize an object and clear memory. No other way to do this. It may be a mammoth task in c++, but it is possible. Everything is possible. Those who say something is impossible are probably out of ideas (or lack of sample code maybe :confused:). Given indefinite time I believe developing applications in c++ would result in robust applications. However what most programmers do today is charge into the arena like a bull! I'd rather like to plan my path. And a piece of paper and a pen that writes is always a good start. I wonder who the hell said: time is money. I'd want to throw my pc at him, and say thankyou very much! It is what people are asking for. It is our society. Most of the time when customers ask developers to do something, they completely drop the ethical sense. The result of this is that you are being pressurized, unnecessarily; or worse the customers themselves pressurizing you, unnecessarily! For if it was the opposite case (i.e. the customers had this ethical knowledge) and they kept pressurizing you, there would at least be some sort of justice/sense in that! (You being nailed to the wall here is not the point). --deostroll
deostroll wrote:
It may be a mammoth task in c++, but it is possible.
Possible yes, but practical no. Just as it's possible to walk from Boston to San Francisco, you'd probably fly or at least travel by car. /ravi
This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com
-
Stroustrup was asked when Java came out what he thought of GC. His core answer was that GC would have killed C++, because of performance issues ( which may have been more real with the speed of processors then, than now ). There are a LOT of differences between C++ and C#. C++ has a better standard library, but C# offers support for things that C++ does not, such as regex. Yes, you can add those, I'm talking core language here. If anything, I think it's a shame C# looks like C++, when it's really very different in many ways.
deostroll wrote:
The result of this is that you are being pressurized, unnecessarily; or worse the customers themselves pressurizing you, unnecessarily!
Really, the issue is that your client has no idea how long software takes, and a strong idea of when they want it. Explain the development triangle to them. Features, time, reliability. You can have two. Tell me which one to sacrifice to get the other two done.
deostroll wrote:
Given indefinite time I believe developing applications in c++ would result in robust applications.
Given *reasonable* time, C++ results in robust applications.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Christian Graus wrote:
Features, time, reliability.
Best two things I learned at a project management course were similar: 1) You can have at MOST two of the following: features, time, cost. Pick one or two that are flexible. The assumption here was that if a feature was to be included, reliability of that feature was not an option - the two went hand in hand. 2) Proposals should include a "what you don't get" section. What the customer won't be getting is just as important as what they will be getting. Cheers, Drew.
-
Well, it's optional. AFAIK, you'll have to place a modifier to the class, so only those classes' instances will be collected.
Hope is the negation of reality - Raistlin Majere
I am glad of that as 99% of the time I have no use for a GC to slow my apps down.
John
-
What is the real difference, you ask? It is there in the title itself. Plus you may argue that c# is more typesafe and stuff; avoids any usually complex pointer logic; avoids pointers totally...yada yada yada... To me it is just the way c# language compiler was designed. When you come down to the compiler level you have to de-initialize an object and clear memory. No other way to do this. It may be a mammoth task in c++, but it is possible. Everything is possible. Those who say something is impossible are probably out of ideas (or lack of sample code maybe :confused:). Given indefinite time I believe developing applications in c++ would result in robust applications. However what most programmers do today is charge into the arena like a bull! I'd rather like to plan my path. And a piece of paper and a pen that writes is always a good start. I wonder who the hell said: time is money. I'd want to throw my pc at him, and say thankyou very much! It is what people are asking for. It is our society. Most of the time when customers ask developers to do something, they completely drop the ethical sense. The result of this is that you are being pressurized, unnecessarily; or worse the customers themselves pressurizing you, unnecessarily! For if it was the opposite case (i.e. the customers had this ethical knowledge) and they kept pressurizing you, there would at least be some sort of justice/sense in that! (You being nailed to the wall here is not the point). --deostroll
what's wrong with this one[^]? although, i believe that the well designed C++ program should extremely rarely exhibit problems with memory issues. The problem is that many devevelopers still write C using C++ compilers, so they malloc/free or new/delete bunch of stuff. I don't see why anyone would allocate memory for an array on the heap if there is std::vector. why would you explicitly delete something if you have std::auto_ptr or some smart pointer implementation (e.g. boost::shared_ptr)? Of course, i am aware that there are situations where you have to go 'classic' way, but that is minority, IMO.
-
goto. *runs*
Stirrer :)
The only thing unpredictable about me is just how predictable I'm going to be.