News for hackers. Stuff that matters.
Re:GCC 4.8 Has Automatic Return Type Deduction by ebassi on Monday December 10, 2012 @05:33AM (#4898426)
a three lines program generates 95 lines of error messages; let's throw a template into it, so that it goes up to 112 lines, but look: at the beginning you'll see the error we added!

coupled with the: "To be fair, this doesn't entirely replace decltype. auto doesn't perfect forward. But it seems to work as expected, most of the time" it goes a great way to instil me a sense of safety.

not.

that post should be taken as an example of why C++ has become a liability, and the day won't come too soon when this joke on the whole industry finally gets dumped like COBOL in the nearest ditch, along with the corpses of all the projects that made the mistake of actually using it.

if it were a living thing, I'd shoot C++ in the face to put it out of its misery.

Re:GCC 4.8 Has Automatic Return Type Deduction by verroq on Monday December 10, 2012 @08:11AM (#4898813)
I don't get all this C++ hate from people that has never even used it.

Personally I want a better C and C++ satisfies most of what I want.

    1. Type level polymorphism (generics/templates/etc)
    2. Easier ways to manage memory (constructors/destructors, auto/shared pointers)
    3. A modules system (namespaces)
    4. Lambdas, etc to make life easier (C++11)
    5. A standard library with useful data structures
    6. Fast
It seems all to me all these haters still think that C++ is just C with classes, but C++ is a fairly vast language and OOP is just a small part.

C++ is blazing fast, it has an elegant standard library and templates do make sense if you know what you are doing.

You are trying to use cutting edge features that aren't properly standardised yet and complain that the error message is a bit long? Granted, template error messages aren't always the one liner you are expecting, but they are readable.

Re:GCC 4.8 Has Automatic Return Type Deduction by ebassi on Tuesday December 11, 2012 @05:35AM (#4903970)
> I don't get all this C++ hate from people that has never even used it.

wrong. I use it every day, on a fairly large code base.

obviously, for portability reasons, nobody working on the project is allowed to even think about C++11, as well as other headache-inducing features - and that includes a fair chunk of the standard library.

Re:GCC 4.8 Has Automatic Return Type Deduction by gurkendoktor on Monday December 10, 2012 @06:14AM (#4898524)
> a three lines program generates 95 lines of error messages; let's throw a template into it, so that it goes up to 112 lines, but look: at the beginning you'll see the error we added!

95 lines of error messages sounds terrible, no doubt. But which language is better in the real world? I am currently consuming a JSON web service written in Java, and I get no less than 30kb of stack trace back when something blows up. Rails' stack traces are filtered by default, but sometimes you still have to jump in there.

And C++ has the advantage that much of this can happen at compile-time.

I agree that almost everything about C++ is broken, but the verbosity of error messages is the smallest of it IMHO.

Re:GCC 4.8 Has Automatic Return Type Deduction by raverbashing on Monday December 10, 2012 @06:41AM (#4898579)
I'm thinking most of the "C++ school" is affected by excesses, still, Java and C# are slightly better

" but the verbosity of error messages is the smallest of it IMHO"

It's merely a consequence of the verbosity/complexity of the language itself

Re:GCC 4.8 Has Automatic Return Type Deduction by wladimir on Monday December 10, 2012 @07:45AM (#4898751)
I read that blog a bit and it seems to have the following pattern overall: elegant 5-line Haskell program. Then follows 100-line unreadable C++ implementation. My conclusion is that C++ is a very bad language to try to do Haskell :-)

This doesn't mean that C++ doesn't have its uses, but for your sanity's sake don't use it for high-level metaprogramming.

Re:GCC 4.8 Has Automatic Return Type Deduction by stingraycharles on Monday December 10, 2012 @05:54AM (#4898475)
The issue you describe is more a compiler-specific issue than a language specific issue. Yes, the language allows a lot of flexibility and therefor in some situations it's hard to nail down an error to a nice, specific error message (mostly when templates are involved), but it's not impossible, as clang++ shows.

Believe it or not, there are people (like me) who actually enjoy coding in C++.

Re:GCC 4.8 Has Automatic Return Type Deduction by fafner on Monday December 10, 2012 @09:37AM (#4899133)
It's a language specific issue. Sure clang++ has improved error reporting and GCC is actually quickly catching up. But the problem is a language issue because an error in a template confronts you with implementation details of the template. There is nothing the compiler can do about it.
Re:GCC 4.8 Has Automatic Return Type Deduction by shin_lao on Monday December 10, 2012 @06:45AM (#4898583)
Or you can use Clang.

Feel free to shoot C++ in the face. Don't forget to rewrite most of compilers and operating systems in use in the process.

Re:GCC 4.8 Has Automatic Return Type Deduction by danieldk on Monday December 10, 2012 @07:23AM (#4898701)
Except that clang++ is only marginally better. E.g. trying to copy a std::copy a string vector in a size_t vector will give you this beauty:

http://pastebin.com/H68j6E50

Cascade a bunch of errors, end you'll soon be writing a script to analyse error output ;).

Re:GCC 4.8 Has Automatic Return Type Deduction by fafner on Monday December 10, 2012 @09:08AM (#4899014)
Clang is not the solution. Yes it has some better error messages. Although GCC is quickly catching up.

But it can't solve the core problem. It's simply the language. The lack of Concepts (or something similar) means that error messages simply refer to implementation internals of the Template you are using. Easily giving you a long cascade of error messages when it's in some Template that is used by the Template.

All of the sudden you have to look at implementation details of your standard library or something even worse such as boost. Just to figure out what the mistake was.

And there is nothing Clang or GCC can do about it.

Re:GCC 4.8 Has Automatic Return Type Deduction by bhaak on Monday December 10, 2012 @07:09AM (#4898659)
Linux doesn't use C++ and AFAIK the BSDs also don't.

So go ahead, I won't have a problem with a dead C++. :-)

Re:GCC 4.8 Has Automatic Return Type Deduction by verroq on Monday December 10, 2012 @08:23AM (#4898846)
Then prepare to drop GCC. Then drop whatever browser you are using and most of the cross platform compatible GUI frameworks (GTK, QT etc).

https://lwn.net/Articles/390016/

Re:GCC 4.8 Has Automatic Return Type Deduction by bratsche on Monday December 10, 2012 @09:38AM (#4899139)
GTK is written in C, not C++.
Re:GCC 4.8 Has Automatic Return Type Deduction by verroq on Monday December 10, 2012 @02:52PM (#4901173)
Sorry was thinking of something else.
Re:GCC 4.8 Has Automatic Return Type Deduction by wolf550e on Monday December 10, 2012 @08:18AM (#4898830)
There is much more to the OS than the kernel. Lots of important software is written in C++.
Re:GCC 4.8 Has Automatic Return Type Deduction by indeyets on Monday December 10, 2012 @08:22AM (#4898844)
that's not a problem in the long-term perspective as it doesn't force anyone else to use C++
Re:GCC 4.8 Has Automatic Return Type Deduction by abrahamsen on Monday December 10, 2012 @07:16AM (#4898675)
What would the clang error message be?
Re:GCC 4.8 Has Automatic Return Type Deduction by btn on Monday December 10, 2012 @08:21AM (#4898841)
It's roughly the same as the improved GCC error message ("index out of range"), but with only 29 extra lines of incomprehensible compiler meandering and stdlib internals!
Re:GCC 4.8 Has Automatic Return Type Deduction by neumann_alfred on Monday December 10, 2012 @09:35AM (#4899126)
projects that made the mistake of actually using it

You mean stuff like Unreal Engine... ?