Well, to be direct, I'm referring to having to teach "new" programmers quite a bit of POSIX.1 stuff, just to get their output into any kind of semi-acceptable state.
In other words, I see programmers learning POSIX.1 interfaces on their own, on top of pretty much wonky concepts, and a majority of them getting it wrong. Then, it takes quite a bit of remedial discussions and advice to get their concepts to a more productive state.
I did not write it in the initial post that way, because of how Windows-only programmers would feel about that. (They're perfectly productive in a Windows environment; why wouldn't their output be considered acceptable in other environments, too? In POSIX environments, their code is like making polygonal wheels out of cardboard, while perfectly good, wide selection of tires are available.)
Fact is, almost none of the tutorials on the web -- including here at cprogramming.com -- teach efficient usage of C99, even less POSIX.1. Even the Linux programming tutorials, books, and manuals often neglect to mention the portability of used features, especially any obstacles to portability.
It is a waste of resources, to put bluntly.
I disagree. For example, you'll never be able to write a tree traversal that is robust even when entries are being renamed or deleted using plain C interfaces. nftw() et al. are supposed to handle those correctly. Whether they do, is a matter of architecture and platform-specific C library implementation, but in my experience, they're pretty robust already.
Well, what I've seen happening, that does not happen until they encounter someone like me, who won't accept their crappy, leaky output.
Producing the correct outputs when given test inputs is not enough; software should not crash or damage unrelated results or data just because some of the inputs were in the wrong format. Detecting and reporting errors is as important as producing correct outputs; otherwise, how do you know when to trust the output? Recheck by hand?
One of the typical examples of that attitude is never checking the return value from scanf() functions. That practice should be curb-stomped, hard, before it becomes a habit to anyone.
I do have similar issues with Fortran. Specifically, not utilizing Fortran 95 features, module interfaces, forall loops, and so on. Not because I like F95 more, but because it allows the compiler to generate better code (especially better vectorized code) without changing the results produced by the code.
I'm not complaining about that here (that much), because there is no Fortran board here.
You thought you were veering off with that discussion, but the fact is, that is very close to why I'd like a sub-board to discuss problem-solving using C99 and POSIX.1 interfaces.
You see, it's not that bugs are OK and expected; it is more that people are only considering a very limited inputs and processing conditions, and everything else is somebody elses problem.
(If it passes what the boss asked, it's good, even if it does not actually work for the business case it was intended to. And since it does what the boss asked, the boss will have a hard time pinning it on the programmer, because the ultimate problem is being a boss who cannot choose good programmers or describe tasks to sufficient detail. So, the problem and blame gets shuffled to others. Been there. Because people like me won't stay quiet about such problems, we're easy targets for blame-shifting too.)
What about the clash with Windows C programmers? Don't you think it might cause unnecessary friction among those who cannot use all of C99 or POSIX, especially if they see a simple answer to their question -- but one that they cannot use?
I personally do get a bit miffed, when reading a question, getting interested, starting to think of ways to help .. then suddenly see the fflush(stdin); or similar, and realize the asker requires help with Windows-specific behaviour, with which I cannot help.
I believe people should be taught to use multiple tools to solve problems. Not always relying on Excel or some other spreadsheet for statistics; you might get the same thing done with a single line awk script if the data was already in a CSV file. Then, you could automate it with a few lines of Python and Qt.
Reeling this back to the original topic, I don't think every C programmer should be taught the traditional ANSI C approaches anymore. I believe the POSIX.1 interfaces (and especially the thread-safe ones, like strtok_r() instead of strtok()) should be the priority, with the ANSI C stuff (like fgets(), gets(), and so on) as just a footnote.
Surprisingly, also a part of the reason for this thread.
Traditional ANSI C/C89 C library is a loaded footgun. It is chock full of hidden dangers, from buffer overruns to non-reentrancy. Teaching it is like teaching a language that has no words to describe whole classes of dangers. Out of sight, out of mind.
With C99 and POSIX.1 libraries, we've figuratively burned our fingers so many times with the old interfaces that we agreed on new ones (that were developed as GNU or BSD extensions, and found to work better). While these are far from perfect, they are an improvement: at least now we have uncovered some of the dangers (especially reentrancy issues), and found ways of protecting against some of them (compare fgets() and getline() behaviour). Now, the various problems are clearly shown in the interface, in the function prototypes. Not out of sight, hopefully not out of mind either.
For example, I suspect that many of those who've managed to read this far, have wondered what would reentrancy have to do with microcontrollers. No, I don't think we'll switch to multi-core microcontrollers, that's not it. Microcontrollers do, however, utilize a lot of interrupt functionality; this is very similar to POSIX.1 signals. Atomicity, hidden state in library functions, and so on, need pretty much exactly the same kind of solutions for the two.
Obviously, most microcontrollers use nonstandard libraries, and they avoid most of those issues by simply defining interfaces where most of those problems are avoided. Still, I think that being familiar with the C99 and POSIX.1 features that avoid similar issues, would make it likelier that developers for microcontrollers and embedded systems would utilize the known solutions, instead of writing buggy code, and hoping nobody will notice.
Most gadgets nowadays are frustratingly unreliable. Sure, some of it is planned obsolescence and cheap materials, but most of it is poor software design. Your 3D printers' end stops are used for homing, but they do not actually stop the device when it is working. Your WiFi-enabled gadget has a "hidden" Telnet port with a fixed username and password the manufacturer uses to update the firmware (except they never have, as the firmware development team was fired when the first version got to market).
"We'll fix the bugs later" has become the standard way of software engineering, and I hate that.
I think my ulterior motive in asking for a POSIX.1 sub-board was an irrational hope that there one could brusquely curb-stomp buggy and bug-prone suggestions, instead of hand-holding and politically correct encouragement, without being pressured to accept all suggestions as equally valuable and precious.
Nah, not going to happen. Might be detrimental to ad revenue, considering that politically incorrect speech is a worse offense nowadays than risking other peoples lives for personal gain.
Hm. I think I'll have to ask my Mistress if she'll allow me to set up my own discussion board, please. Now, where did I put my ball gag?