Subj : Re: Compiler and an interpreter To : comp.programming From : Jon Harrop Date : Sat Jul 30 2005 03:51 pm Gerry Quinn wrote: > Typically an interpreter will stop on the first error. Compilers in my > experience usually carry on until a fixed number of errors (e.g. 100) > have been found, and then stop. Lots of compilers don't do that. > Usually in C++, if there are eight errors found, there really are about > eight. C++ isn't worth using unless you use the STL, IMHO. Error messages from all of the compilers that I have seen are completely unwieldy when using the STL. For example, the following code contains an extra "const": #include #include #include #include #include int main() { std::list L(7); const std::list::const_iterator first_positive = std::find_if(L.begin(), L.end(), bind2nd(std::greater(), 0)); std::cout << (first_positive == L.end() || *first_positive > 0) << std::endl; return 0; } which gives these errors with g++: /usr/include/c++/3.3/bits/stl_alloc.h: In instantiation of `std::allocator': test.cc:8: instantiated from here /usr/include/c++/3.3/bits/stl_alloc.h:662: error: `const _Tp* std::allocator<_Alloc>::address(const _Tp&) const [with _Tp = constint]' and `_Tp* std::allocator<_Alloc>::address(_Tp&) const [with _Tp = const int] ' cannot be overloaded test.cc: In function `int main()': test.cc:10: error: conversion from `std::_List_iterator' to non-scalar type `std::_List_iterator' requested /usr/include/c++/3.3/bits/stl_construct.h: In function `void std::_Construct(_T1*, const _T2&) [with _T1 = const int, _T2 = int]': /usr/include/c++/3.3/bits/stl_list.h:415: instantiated from `std::_List_node<_Tp>* std::list<_Tp, _Alloc>::_M_create_node(const _Tp&) [with_Tp = const int, _Alloc = std::allocator]' /usr/include/c++/3.3/bits/list.tcc:89: instantiated from `std::_List_iterator<_Tp, _Tp&, _Tp*> std::list<_Tp, _Alloc>::insert(std::_List_iterator<_Tp, _Tp&, _Tp*>, const _Tp&) [with _Tp = const int, _Alloc = std::allocator]' /usr/include/c++/3.3/bits/stl_list.h:1066: instantiated from `void std::list<_Tp, _Alloc>::_M_fill_insert(std::_List_iterator<_Tp, _Tp&, _Tp*>, unsigned int, const _Tp&) [with _Tp = const int, _Alloc = std::allocator]' /usr/include/c++/3.3/bits/stl_list.h:833: instantiated from `void std::list<_Tp, _Alloc>::insert(std::_List_iterator<_Tp, _Tp&, _Tp*>, unsigned int, const _Tp&) [with _Tp = const int, _Alloc = std::allocator]' /usr/include/c++/3.3/bits/stl_list.h:478: instantiated from `std::list<_Tp, _Alloc>::list(unsigned int) [with _Tp = const int, _Alloc = std::allocator]' test.cc:8: instantiated from here /usr/include/c++/3.3/bits/stl_construct.h:78: error: invalid static_cast from type `const int*' to type `void*' > When there are 100 errors, you left out a curly bracket > somewhere above the first one, or something like that. What you are saying is true in C but not in C++. -- Dr Jon D Harrop, Flying Frog Consultancy http://www.ffconsultancy.com .