C3

Started by
331 comments, last by Yohomyth 19 years, 8 months ago
quote:The most obvious being, of course, automatic garbage collection, but others further complicating that.

I''ve heard of automatic garbage collection, but what is it?



-----------------------------------------------
Here comes the Thnikkaman!
------------------------------------------------------------"Many combilations elizagerth. I hope you see my particles." - Senor Cardgage
Advertisement
i my opinion, its the little suff your required to do in C++ thats makes it easier in the long run. For example, the ending of every line of code with a ; makes handling some if statements easier. Just stuff like that makes C++ easier, and this coming from a guy whose first languages were LibertyBASIC and BlitzBASIC. but there''s a catch: Only when you''ve fully grasped the concepts of C++ will you start to see thats its intricacies, like ending all your lines with a ; are wht make it easier in the first place

Simple.

In C++, if I have a function that looks like this:

Object* MakeAnObject(bool WithThisParameter){    return new Object(WithThisParameter);}


There is nothing that is guaranteed to free the newly allocated memory. In short - you get a memory leak.

You don''t have that issue with garbage-collected languages, because they automatically free any memory that''s not being used ("dead" objects).

It''s a decent idea, but it takes a way quite a bit of flexibility (though, granted, it''s more of a speed concern than a flexibility one).

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

quote:Original post by Etnu
Simple.

In C++, if I have a function that looks like this:

Object* MakeAnObject(bool WithThisParameter){    return new Object(WithThisParameter);}


There is nothing that is guaranteed to free the newly allocated memory. In short - you get a memory leak.

You don''t have that issue with garbage-collected languages, because they automatically free any memory that''s not being used ("dead" objects).

It''s a decent idea, but it takes a way quite a bit of flexibility (though, granted, it''s more of a speed concern than a flexibility one).


I love garbage collection. However, I don''t like most of the languages that come with it.

Not giving is not stealing.
quote:Original post by Yohomyth
What the hell? I started this topic to get ideas to help my friend who is attempting to make a compiler, and it''s turned into a place for people who think it would be evil if C++ was a little easier.
Based on one reply out of 32? You sure are sensitive.

By the way, if your friend is really trying to make a compiler, tell him not to make "an improved C++" compiler but to create a compiler for a better language altogether. It can still be as fast (or faster!) as C++ if you add the right features like type inference and real macros.

quote:
Original post by Andrew Russell
C++ is so great because it isn''t bogged down with the unnecessary.


Heh.
you can try to take a look at D. It is sort of such a cleanup of C++, wich tries to save the goods of C++ as well.

just for some inspiration.



If that''s not the help you''re after then you''re going to have to explain the problem better than what you have. - joanusdmentia

davepermen.net
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

If only all our programs could be in Lua...heh

Try structure and interpretation of Computer Programs and give scheme a try. There is a free Java Interpreter and a free compiler.

Scheme(and Lisp) lacks some in the readability department(how much is a hotly contested issue), but the power is second to none. Continuations and Syntax redefining macros are 10x anything available in C/C++/C#.

For language discussions try here and here.
quote:Original post by Etnu
Simple.

In C++, if I have a function that looks like this:

Object* MakeAnObject(bool WithThisParameter){    return new Object(WithThisParameter);}


There is nothing that is guaranteed to free the newly allocated memory. In short - you get a memory leak.


*potential* memory leak. It''s the programmer''s responsibility not to leak memory.

quote:

You don''t have that issue with garbage-collected languages, because they automatically free any memory that''s not being used ("dead" objects).


And if you mistakenly hold onto references that you no longer need, you leak memory in Java as well.

It''s all about programmer responsibility.


I never claimed that garbage-collected languages are perfect; I just pointed out how they work. Personally, I find that there are other advantages with Java (or C#) that make it the preferrable language in many ways to C/C++ (for CERTAIN TASKS), but that''s beside the point.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

This topic is closed to new replies.

Advertisement