News for hackers. Stuff that matters.
Re:The C++14 Standard: What You Need to Know by raverbashing on Wednesday September 17, 2014 @09:47AM (#8329888)
The best thing that has happened in the last years is not having to depend on C++ anymore

Good changes, but too little, too late.

Of course, we still depend on it, but for an ever smaller set of use cases. Do what you have to do and "get out of there" as fast as you can to your favourite language.

Re:The C++14 Standard: What You Need to Know by Ragnarork on Wednesday September 17, 2014 @10:42AM (#8330208)
This is still a matter of opinion. My favorite language is still C++.

This is of course personal preference, but also mostly because I realized (and it seems to me that some people haven't, just go around and ask what is C/C++, and people will tell you it's one language...) that C++ is not just anymore "C with classes", and the fact there is C-ish, or even just bad C++ code out in the wild doesn't make the language bad in itself (it can still be less appropriate/completely irrelevant for some applications, which is fine).

Re:The C++14 Standard: What You Need to Know by raverbashing on Wednesday September 17, 2014 @01:27PM (#8331165)
True, with STL and the recent changes the "C with classes" thing gets more distant.

But sorry, I don't miss the includes, the huge class hierarchies, the template madness, etc

C++ is good if you stick to a strict code standard and don't let people "go crazy" with it.

But the thing is that good languages end up limiting the amount of "bad code" that naturally emerges. (Java does it through lack of flexibility and enforcement, I prefer the Python and Go way)

Re:The C++14 Standard: What You Need to Know by progman on Wednesday September 17, 2014 @10:12AM (#8330033)
The examples remind me again why I turned away from C++ some years ago.

In the first years of C++ it was real joy to write software in it but now the syntax seems to be much more useful for obfuscation rather than maintainability.

Funny: When C++ began Ada 95 looked like a giant animal. Now Ada 2012 looks small and efficient in comparison although it is more powerful than Ada 95.

Re:The C++14 Standard: What You Need to Know by pjmlp on Wednesday September 17, 2014 @10:36AM (#8330165)
Unfortunately Ada got relegated for niche areas where safety is of highest importance.

System programming languages need OS vendors support to thrive.

Re:The C++14 Standard: What You Need to Know by progman on Wednesday September 17, 2014 @12:14PM (#8330720)
Ada is a general purpose programming language, including systems programming.

http://www.ada2012.org

Support is provided by AdaCore for instance:

http://www.adacore.com

Re:The C++14 Standard: What You Need to Know by pjmlp on Wednesday September 17, 2014 @01:43PM (#8331274)
I do know a little bit about Ada, thanks.

The point being systems programming languages die if not sponsored by the OS vendors, because they have to fight for mindshare among the so called business languages.

In Ada's case, the high cost of development systems, rise of UNIX use in the enterprise, decline of Pascal based languages.

All contributed to it being used in its field of origin (avionics) and systems where security and human life are of utmost importance.

In Europe there was a rise of Ada projects due to lack of security in the usual C and C++, but these are always specialized projects, like train systems control and such. Not the typical Show HN applications.

I would like to see Ada being more used in the industry, but sadly it won't happen.

Re:The C++14 Standard: What You Need to Know by progman on Thursday September 18, 2014 @05:20AM (#8334367)
> In Ada's case, the high cost of development systems

Not necessarily.

http://www.adacore.com/press/gnat-gpl-for-bare-board-arm/

Look also for the book "Building Parallel, Embedded, and Real-Time Applications with Ada" by McCormick, Singhoff and Hugues.

Some prominent embedded engineers wonder why Ada is not used much more:

http://www.embedded.com/electronics-blogs/break-points/40082...

> Rise of UNIX use in the enterprise

Ada is available for Windows, Linux, OSX and ARM. GNAT/GCC is part of many Linux distros (usually Ada95). You can also download Ada2012 and Ada2014 compilers and tools from Adacore's website.

> Decline of Pascal based languages.

Ada looks a bit like Pascal but the language is far superior. In my opinion Ada's syntax makes software easier to maintain than C/Java like syntax. Even after years I have no problem to read into Ada code. C++ code can be difficult to read just after a short time.

I think the real reason of Ada's decline is that it requires a lot of discipline of the developer. The same kind of discipline is required in Haskell. You cannot just sit down and code. You have to think a lot about your design before you hit the first key. Most developers don't like this, they want quick (and dirty) solutions, and they get it with C and C++.

Re:The C++14 Standard: What You Need to Know by pjmlp on Thursday September 18, 2014 @06:07AM (#8334461)
You are missing the 80's picture.

Back when we had to buy compilers for anything we wanted to do.

Ada compilers and hardware requirements were too complex to target home computers, which we were mostly coding in Assembly for performance and space reasons.

On the computer systems able to use Ada compilers, they were either running UNIX or some other mainframe OS.

Maybe you don't know that Rational Software first product was a Ada Machine in the same vein as Lisp Machines, but with Ada.

https://www.ibm.com/developerworks/community/blogs/gradybooc...

On the UNIX systems when you bought the SDK, there was only C compiler there, latter C++ as well. Getting Ada meant shelling out for an extra compiler, now get business to pay for it.

Mainframes like VMS were a bit more friendly to Ada, but if I remember correctly, still you need to pay for each language separately.

So it doesn't matter where Ada is available today, but how its use since the early 80's progressed.

Now it has to fight against established languages. Its use has been increasing in Europe (check FOSDEM Ada talks) mainly thanks to C and C++ security exploits and GNAT Core OSS efforts, but it is a slow progress.

Re:The C++14 Standard: What You Need to Know by cbd1984 on Wednesday September 17, 2014 @04:35PM (#8332228)
How is Ada safer than Haskell?

Everyone talks up Ada's safety, but they always seem to compare it to other Foogols, like C, C++, and Java/C#.

Re:The C++14 Standard: What You Need to Know by pjmlp on Thursday September 18, 2014 @03:21AM (#8334100)
It is a different type of safety. Algol type safety, that C designers didn't care when creating the language rather leaving it out to lint.

You cannot directly compare Ada with Haskell just on safety as they use different paradigms.

Anyway, just from the top of my head:

- Bound checked arrays

- Real strings

- Reference parameters

- Real enumerations without implicit conversions to numeric data types

- Type definitions are real types, not synonyms like C's typedef. Just like Haskell's newtype.

- Ability to define type ranges for enumerations and numeric types

- Subtyping

- Generics

- Explicit type conversions required among numeric types.

- Contracts, Eiffel style

- Pointers by default are always valid, unless your are doing unsafe code.

In terms of performance, there are ways to enable unsafe code, if you really really need it, but like other memory safe systems programming languages you need to be explicit about it.

A plus feature over Haskell is that currently the Ada has primitives for hardware access. The guys doing HaLVM and Home had to add extensions to Haskell.

Re:The C++14 Standard: What You Need to Know by pjmlp on Wednesday September 17, 2014 @10:31AM (#8330133)
> Do what you have to do and "get out of there" as fast as you can to your favourite language.

Which happens to be C++, until OS vendors support another one on their SDKs.

So until Ada, Rust, D, Swift, .NET Native or something else get such a position, C++ it is.

Re:The C++14 Standard: What You Need to Know by mwcampbell on Wednesday September 17, 2014 @11:42AM (#8330536)
For what types of applications do you think it's actually important to use the native language of the OS? After all, non-native languages can have bindings for the OS APIs. In your opinion, what are the drawbacks of mostly avoiding C++ and using one's favorite language, as the GP said?
Re:The C++14 Standard: What You Need to Know by pyrois on Wednesday September 17, 2014 @12:36PM (#8330840)
If you're developing a fairly complex library for things such as image processing, machine learning, numerics, linear algebra, etc., then I think that C/C++ is the way to go. Most languages have some sort of FFI to interact with C, many are even designed explicitly to work with C (such as Cython). C++ is in a similar situation (though compiler support on esoteric processors such as DSPs is still not quite there yet), and it's fairly easy to get a C-compatible API.

If you write your library in Perl, guess what, only people writing Perl will use it. If you write it in Java, well, maybe the Scala folk will wrap it up, or the Jython folk, but you won't get any people writing in Ruby to use it. If you write it in C++, you can provide efficient bindings to any of those languages.

For an example, look at FFmpeg or ImageMagick. They are libraries that just _won't die_, no matter how hard people have tried. My god, ImageMagick was written in 1987, and it now has Haskell bindings[0]! The only way to get that sort of longevity (and old code is good code, after all [1]) is to write in language that will outlast the ups and downs of the language or framework du jour, and C and C++ have proven to have that staying power. Yeah, they're terrible; I hate them. But there is a reason to use them.

[0] http://hackage.haskell.org/package/imagemagick

[1] http://www.joelonsoftware.com/articles/fog0000000069.html

Re:The C++14 Standard: What You Need to Know by pjmlp on Wednesday September 17, 2014 @01:52PM (#8331323)
- Not able to use the OS vendor tooling which only support the official languages

- Another layer to debug (FFI)

- Possible loss of performance when crossing the FFI barrier

- Loss of productivity, because that cool API isn't available and so one has to write it

- Writing drivers, daemons/services, OS plugins, ...

One of the reasons I moved from Turbo Pascal to C++, when I started coding on Windows 3.0, was being fed up to write binding libraries by myself. Although I really enjoyed Turbo Pascal back then.

Re:The C++14 Standard: What You Need to Know by mwcampbell on Wednesday September 17, 2014 @02:26PM (#8331539)
I can confirm that writing bindings is a big time sink. One of the biggest projects I've worked on is a Win32 application that's primarily written in Lua. I chose Lua because of the small interpreter and minimal standard library; a project requirement was to keep the download size small. But I spent a lot of time writing my own Lua bindings for Win32 APIs. Maybe that just means I should have used a more mainstream alternative language like Python, but even in Python-based Windows projects, I've sometimes had to drop down to ctypes, Cython, or the like. In recent years I've wondered if I would have been better off using C++ in a modern style, with smart pointers, string and container classes, etc. Then I would have had direct access to all Windows APIs, plus access to all of Microsoft's tools.
Re:The C++14 Standard: What You Need to Know by 4ad on Wednesday September 17, 2014 @10:03AM (#8329966)
Agreed. Many bad trends emerged in the industry in the last decade, but today I am happy I can afford not to write C++ anymore. And yes, I did say afford there.
Re:The C++14 Standard: What You Need to Know by general_failure on Wednesday September 17, 2014 @10:13AM (#8330042)
Excellent wording. My employer cannot afford my team to write c++ either. It takes way too long to yeah each person the language features. C++ is awesome for seasoned developers but it tak s years to get there. Cannot wait for rust.
Re:The C++14 Standard: What You Need to Know by progman on Wednesday September 17, 2014 @10:30AM (#8330119)
> Cannot wait for rust.

Yes, Rust looks VERY promising.