Getting completely (I mean ENTIRELY) rid off GC

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 12 08:39:04 PDT 2014


On Thursday, 11 September 2014 at 20:55:43 UTC, Andrey Lifanov 
wrote:
> Everyone tells about greatness and safety of GC, and that it is 
> hard to live without it... But, I suppose, you all do know the 
> one programming language in which 95% of AAA-quality popular 
> desktop software and OS is written. And this language is C/C++.

Because due to the way the market changed in the last 20 years, 
compiler vendors focused on native code compilers for C and C++, 
while the
others faded away.

>
> How do you explain this? Just because we are stubborn and silly 
> people, we use terrible old C++? No. The real answer: there is 
> no alternative.

There used to exist.

I am old enough to remeber when C only mattered if coding on UNIX.

>
> Stop telling fairy tales that there is not possible to program 
> safe in C++. Every experienced programmer can easily handle 
> parallel programming and memory management in C++. Yes, it 
> requires certain work and knowledge, but it is possible, and 
> many of us do it on the everyday basis (on my current work we 
> use reference counting, though the overall quality of code is 
> terrible, I must admit).

Of course, it is possible to do safe coding in C++, but you need 
good coders on the team.

I always try to apply the safe practices from the Algol world, as 
well as, many good practices I have learned since I got in touch 
with C++ back in 1993.

My pure C programming days were coffined to the Turbo Pascal -> 
C++ transition, university projects and my first job. Never liked 
its unsafe design.

Now the thing is, I could only make use of safe programming 
practices like compiler specific collections (later STL) and RAII,
when coding on my own or in small teams composed of good C++ 
developers.

More often than not, the C++ codebases I have met on my projects 
looked either C compiled with a C++ compiler or OOP gone wild. 
With lots of nice macros as well.

When the teams had high rotation, then the code quality was even 
worse.

A pointer goes boom and no one knows which module is responsible 
for doing what in terms of memory management.

We stopped using C++ on our consulting projects back in 2005, as 
we started to focus mostly on JVM and .NET projects.

Still use it for my hobby coding, or some jobs on side, where I 
can control the code quality though.

However, I am also found of system programming languages with GC, 
having had the opportunity to use the Oberon OS back in the 
mid-90's.

--
Paulo



More information about the Digitalmars-d mailing list