News for hackers. Stuff that matters.
Re:A theory of how developers seek information by onei on Thursday April 29, 2021 @04:11AM (#26978574)
I remember helping a friend on a uni project we were writing in C. Of course, a C compiler very rarely output an actual error, just a bunch of warnings. My friend saw the warnings, figured "they're not errors, so they're ok to ignore for now" and kept scrolling to find their code flat out didn't work. When I pointed out the warning were actually errors and we went through and fixed them all, it magically started working.

I think debugging is a hard-won skill that comes from fixing your own mistakes and having the patience to trawl though logs for hints.

Re:A theory of how developers seek information by TeMPOraL on Thursday April 29, 2021 @04:42AM (#26978755)
Yeah, during high school and uni years, whenever I helped someone with C/C++ assignments or projects, the very first thing I taught them was:

1) How to add `-ansi -pedantic -Wall` to their compilation flags.

2) That they absolutely have to do it whenever they're coding C/C++.

3) That they need to read and then clear out all the warnings before continuing to code.

Suddenly, their programs started to work most of the time, instead of crashing or hanging.

I still give this advice whenever I teach people, but with modernized set of flags. That'll be `-Wall -Wextra` and `-std=c++17`, or whichever standard is most current for their situation. Recently I've been teaching people who use MSVC community edition, so I tell them where to bump the warning level in setting - and the IDE is good at catching and annotating typical mistakes too.

Myself, I do all that + run clang-tidy for good measure.

(Another C/C++ thing that beginners need to be told is that, for any given translation unit with compile errors in it, they should always focus on the first couple errors, particularly on the very first one. A compilation error usually confuses the compiler, so anything past the first one or two is usually garbage, and disappears if you fix the real ones.)

Re:A theory of how developers seek information by inglor_cz on Thursday April 29, 2021 @07:58AM (#26980030)
There was a slightly frustrating time in my life when I had to compile a single source base with several compilers (MSVC, Clang, GCC, CodeWarrior and ARMCC), whose tolerance for various quirks was rather incompatible.

I do not remember the details anymore, but some code provoked a compiler warning from one of the compilers, while its easiest fix provoked a compiler warning from another of the compilers.

I wanted to keep my -Wall, but it required strange twists of code sometimes.

Re:A theory of how developers seek information by emeraldd on Thursday April 29, 2021 @08:47AM (#26980472)
Knowing why a warning happens and being able to say that a particular warning is safe to suppress in a given instance is a reasonable way to deal with that case. There isn't a lot else you can really do... but you need to know the why part and have a documented explanation of for the suppression.