jahboater wrote: ↑Thu Oct 17, 2019 4:11 am
ejolson wrote: ↑Thu Oct 17, 2019 3:06 am
Is there any way to turn off all that ASCII art? It's filling my screen and causing the error messages to scroll off the top.
Not the same, but you can reduce the amount of error message output from gcc:
Code: Select all
$ g++ -Werror -Wfatal-errors try.cpp
Yes, gcc takes the Build-Your-Own-Compiler approach by having to micro-manage every aspect of its behaviour via command line options, even down to refining the exact language you want to compile and whether some features should be allowed or not.
I've used gcc for C, and the output you get can be very unhelpful in terms of the quantity. There might be an actual error report but then hundreds of harmless warnings. But the error message, if any, has scrolled off the top of the screen. So did it compile successfully or not? Often the only hint is whether there is a delay after all the output, indicating that it is proceeding with the next stages rather than aborting, but there is no final message. You have to resort to scrolling the window, or capturing the output and scanning for errors, or capturing its return code, or even checking for whether a new executable exists!
So gcc itself is decidedly not beginner-friendly.
My own compilers are rather simple: there are no warnings, only hard errors. And they will show the first error and then stop. Then you can fix that one and try again (the compiler generates an info file that is picked up by my editor to take you straight to the error line in the right file). Since you have to fix one error at a time, why not show one error at a time? One error would often results in dozens of follow-up ones anyway if the compiler attempts to proceed.
We're not batch-compiling programs overnight anymore so that you have fix as much as possible to avoid wasting another day! Compilers, even gcc, are quick enough now, at least for the initial error-detecting phases, to just run them repeatedly. Quicker than perusing 18,000 lines of warnings anyway (which is what I've had on a 30,000 line input).
As for the error in my C++ example, that's not possible in any of my languages because it uses a sane means to do output ('print "Hello"), which is another obvious way of being more friendly. (Note that C++ can also make use of C's 'printf'-style functions to do output, also avoiding using the ugly std::cout and <<, but then you have to contend with 'format codes', which tells the compiler you are printing an integer, of a particular size and type, information it actually already knows.)