Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I want...

Name: Anonymous 2011-07-09 15:55

A language that:
- Can be compiled to native code.
- Can use OO abstractions.
- Is not Java.
- Is not C++.
- Is not C#.

What I am searching for?

Name: Anonymous 2011-07-14 14:24

Working without GC is easy, at least in C++.

Most of the time you can just use stack. When you actually need heap allocation, most of the time you can wrap it in class and release the memory in destructor. That way you won't get  memory leaks.

Sometimes you don't have to wrap the memory in class yourself, but you can use auto_ptr (deprecated) or unique_ptr. That is just as effective as manually using new and delete, but is exception safe and is easier to manage (also you can't forget to free memory). shared_ptr is also ok in some cases, but has some overhead and you can avoid using that by just designing your code better.

However, you have to keep the releasing of the memory in mind when you design your program. If you cannot do that, you are a bad programmer, and should just use GC language.

It really isn't that hard. Only thing you have to remember, is that whenever you use new, you have to also have some mechanism to free the memory.

I agree GC is ok for some cases, for example in scripting languages, where you don't need a good performance. However, many applications that have be coded with GC'd language (like C# or Java) are slow. I'm not sure if it's because they are not native code or because of GC? Some people claim that JIT should make the byte code as fast as native code, so that leaves the GC to be blamed. Or maybe it's because the "premature optimization is the root of all evil" claim that makes these software slow? I don't think so, because software written is C is almost always fast, and software written in C# and Java is almost always slow.

Or maybe it's because coders that need GC are bad programmers and produce slow code?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List