-
A bit of fairness
2007-12-15 13:10 in /tech
It’s been about 10 years since I did anything more than dabble occasionally with C++. The last time I did any serious programming in the language, the compiler support was bad enough that you couldn’t really use most of the STL. Now I find myself actually using this stuff instead of just reading about it, and I’m realizing something. The reputation that functional languages have for incomprehensible error messages is completely undeserved. An exhibit for your consideration:
info_header.c:425: error: no match for ternary 'operator?:' in '__gnu_cxx::operator== [with _Iterator = dr_hash*, _Container = std::vector<dr_hash, std::allocator<dr_hash> >](((const __gnu_cxx::__normal_iterator<dr_hash*, std::vector<dr_hash, std::allocator<dr_hash> > >&)((const __gnu_cxx::__normal_iterator<dr_hash*, std::vector<dr_hash, std::allocator<dr_hash> > >*)(&pos))), ((const __gnu_cxx::__normal_iterator<dr_hash*, std::vector<dr_hash, std::allocator<dr_hash> > >&)((const __gnu_cxx::__normal_iterator<dr_hash*, std::vector<dr_hash, std::allocator<dr_hash> > >*)(&(&ads)->std::vector<_Tp, _Alloc>::end [with _Tp = dr_hash, _Alloc = std::allocator<dr_hash>]())))) ? 0l : (&pos)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* [with _Iterator = dr_hash*, _Container = std::vector<dr_hash, std::allocator<dr_hash> >]()'What happened was that I was trying to return a structure, rather than a pointer to the structure, from a function. Now, GHC would have given me a nice message that said that: expected type *Foo, inferred type Foo, etc. But, g++ barfs this ridiculous monstrosity. I don’t think anyone can reasonably argue that this is clearer.
Comments
Christopher Smith wrote:
Kevin wrote:
Christopher Smith wrote:
Jeremy Leader wrote:
Leave a comment
Please use plain text only. No HTML tags are allowed.
Comments are closed for this story.
Trackbacks are closed for this story.