News for hackers. Stuff that matters.
Re:GCC 4.8 Has Automatic Return Type Deduction by lmm on Monday December 10, 2012 @09:14AM (#4899039)
>I really miss the ability to compile to native code in most implementations for mainstream languages nowadays.

What's your use case for it? Is it covered by .net's (often overlooked) native compilation capabilities?

Re:GCC 4.8 Has Automatic Return Type Deduction by pjmlp on Monday December 10, 2012 @09:42AM (#4899150)
True, but it is one specific case and not multi-platform (Mono does not run everywhere where C++ does).

If you need to make C# work in all scenarios C++ is used, then a compiler with static linkage is also required for scenarios where deploying CLR is not possible. A compiler like Bartok.

Specially if you would like to replace C++ everywhere where it is being used.

So I've learned to make use of "Worse is better" philosophy and keep using C++ for my native code needs.

Re:GCC 4.8 Has Automatic Return Type Deduction by lmm on Monday December 10, 2012 @10:21AM (#4899322)
Can you give specific use cases? Obviously there are some things that need e.g. manual memory management, but my instinct is that situations where you need to have the same module do both that and use high-level C++ features are vanishingly rare. So I'd be inclined to replace C++ with C in a few cases and a high-level languages in other cases.
Re:GCC 4.8 Has Automatic Return Type Deduction by pjmlp on Monday December 10, 2012 @10:55AM (#4899543)
- Games

- Systems programming

- Compiler development

- Being able to deliver an application without depending on a VM

Re:GCC 4.8 Has Automatic Return Type Deduction by lmm on Monday December 10, 2012 @11:55AM (#4899963)
- Games

Maybe. I'm currently playing lots of Kerbal Space Program, and didn't even realise it was written in C# (well, I noticed how hot it makes my laptop).

I can see for something like an FPS engine you'd want as much performance as possible, but doesn't that mean C (and increasingly CUDA and friends)? Similarly big physics number-crunching tends to be in fortran, sometimes with python to glue it together.

- Systems programming

As in kernels? Linux famously uses pure C.

- Compiler development

Does that need to be C++? I believe most if not all of the Java compiler is written in Java.

- Being able to deliver an application without depending on a VM

Why would that ever be a requirement? What's the difference between a VM and a runtime library (which even C has)?

C++ might sometimes be the best choice, but I don't think it's the only option for any of these cases.

Re:GCC 4.8 Has Automatic Return Type Deduction by pjmlp on Monday December 10, 2012 @03:52PM (#4901427)
> well, I noticed how hot it makes my laptop

That says it all

> Does that need to be C++? I believe most if not all of the Java compiler is written in Java.

Depends which compiler you mean. Oracle's is a mix of C++ and Java.

> Why would that ever be a requirement? What's the difference between a VM and a runtime library (which even C has)?

They are not several megabytes in size.

You seem to like C, fine for you.

I won't touch C again unless one of my customers requests me to.

Clang, GCC already moved to C++.

Haiku, Symbian, z/OS, Mac OS X drivers and many parts of Windows kernel are written in C++.

Re:GCC 4.8 Has Automatic Return Type Deduction by greyfade on Thursday December 13, 2012 @07:07PM (#4918874)
Haiku is written in C++ because BeOS 5 was written in C++, using the GCC-2.95 compiler. BeOS used C++ because when it was written, C++ was the new trendy OOP language. They use GCC-2.95 because the GCC 2.96 compiler was badly broken and GCC 3.x changed the ABI. The dialect of C++ supported by GCC-2.95 is based on extensions to C++98 that were rather quite buggy. It's a bit of a mess, and I would hardly hold it up as a positive example of C++ in use.

Similarly, Windows was written primarily in C, as it predated C++. Their compiler was extremely buggy and had only partial support of features in C++98, so the vast majority of the code in Windows is C with Classes. (Unless there's been a lot of rewritten code in the last 15 years or so.) Again, not exactly a positive example.