Re: Why C/C++ errors are SO obscure/devious??



Massimo Soricetti wrote:
I'm not a C newbie, but I'm teaching C programming (well... FIRST programming and then C) to other guys these days and it's driving me to some reflexions on the language.

It's not uncommon to forget a } writing code, and at compiling time get an error 18956778 lines after the mistake, in an otherwise absolutely correct piece of code. Or, sometimes in my journeys I got errors reported in a file, checked and found it correct, and discovered it was caused by an error in another file. And in general, I noted that many, if not all, error messages from the compiler are VERY short and cryptic, while a couple of words more could sometimes help a lot in understanding what's wrong and where, for newbies. Well, not only for them... maybe a compiler switch --NOOB_ERR_MSGS could be very handy for some people :o)
....
What are your opinions on this matter?

The preprocessor is the source of all evil when it comes to locating compilation errors.


August
.



Relevant Pages

  • Re: namespaces and main()
    ... > You're not writing code twice, just declarations. ... information for the linker to check if any exported type information ... again lack of adequate information passed from the compiler to ...
    (comp.lang.cpp)
  • [PATCH v2] check spinlock_t/rwlock_t argument type on non-SMP builds
    ... When writing code for UP without CONFIG_DEBUG_SPINLOCK it's easy to get ... the first argument to the spinlock/rwlock functions wrong. ... Change the intermediate macros into inline functions. ... on generated code (assuming the compiler is listening). ...
    (Linux-Kernel)
  • Re: c# interview question
    ... uses the ToString() method anyway. ... between the two would have been optimized away by the compiler, ... If you're writing code where these differences are ... significant, use C or C++, or even Assembly language. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: newbie exploring better ways
    ... therefore relying on it is like writing code that depended on certain ... variables being elided by the compiler in optimisation phase. ... disclaimers about inherent limitations, ... And then, if it doesn't, or it's slow, when I profile it, I will see ...
    (comp.lang.lisp)
  • Re: best evm for virtex-4 and linux
    ... I've written a lot of code that ran without memory protection ... a compiler with strong type checking and that excludes ... I was writing code ... Please do not send unsolicited bulk e-mail or unsolicited ...
    (comp.arch.fpga)