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




"Massimo Soricetti" <massimo_main@xxxxxxxxxxx> wrote in message
news:IM%Qe.120733$fm.7885188@xxxxxxxxxxxxxxx
> Hello,
>
> 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,
Very uncommon... get your students in the habit of typing the closing
brace immediately after typing the opening brace... then fill in the middle.

> and at compiling time get an error 18956778 lines after the mistake
Your functions are too long ;-)

> 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)
>
> Why can't a compiler give more accurate informations about errors?
> Shouldn't this save time, stress and money?
What is your question relating to the C standard? (which is the topic of
this newsgroup)

> Another example: have you ever met the error line "Multiple definitions
> of..."?
Nope.

> For example, why can't a compiler start a negotiation "on the fly" like
> this:
>
> ERROR: Multiple definitions of <variable|function|method> X.
> X defined:
> 1) <here1> as variable
> <line of code definition...>
> 2) <here2> as variable
> <line of code definition...>
> 3) <here3> as function
> <line of code definition...>
> Choose which definition is the right one:
>
> This is "interactive compiling", isn't it? Why not? Why the compiler can't
> simply ask us, in doubt, and on response modify sources accordingly on its
> own, in this case and in other similar? This would ease the programming
> effort a lot.
>
> What are your opinions on this matter?
I don't want the compiler modifying my sources on it's own!
I'd prefer to see students taught by competent teachers...
That would ease the programming effor a lot! :-)

Mark


.



Relevant Pages

  • Re: [EGN] Numerical Accuracy
    ... The advice worked because in fact the Microsoft compiler had a bug. ... The capabilities of the optimizer are not so ... The language standard itself says ... of "programming" as a nonprofession. ...
    (comp.programming)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... and just hone in on the stuff related to programming and this newsroup] ... moron that was taken from optimization which does hoist when to do so ... compiler design and optimization, including my 1976 text in graduate ... loop in a language in which the designers messed up, ...
    (comp.programming)
  • Re: Javas performance far better that optimized C++
    ... The compiler is extremely stupid. ... no memory leaks are guaranteed. ... However I have GC in my .NET programming. ... "C.9.1 Automatic Garbage Collection ...
    (comp.lang.cpp)
  • Re: Multi Threading Options
    ... An idea I tried was to build in an object-based file system back around 1977. ... and had no interest at all in the underlying byte stream sent to a compiler. ... something seriously missing in modern programming environments. ... but in a truly modern programming environment these would ...
    (microsoft.public.vc.mfc)
  • Re: Aspiring highest-order programmer
    ... book", Sherman's Programming and Coding for Digital Computers, was ... an IBM 7094 running IBSYS as an OS and with a Fortran compiler. ... Thus today I am confident that computer science students learn "all ... > long, very long, and not exactly focused on NP completeness). ...
    (comp.programming)