4 ms·
FWIW, the Epitech cursus starts your very first C programming lesson by making you write a "my_putchar" function that does a "write" syscall with a single chara
by PoignardAzur 3y ago
FWIW, the Epitech cursus starts your very first C programming lesson by making you write a "my_putchar" function that does a "write" syscall with a single character. Then you spend the next few days learning how to create my_putnbr, my_putstr, etc, using that single building block.
I think that's the right choice, by the way. Baby developers don't need to learn efficient I/O, they need to learn how you make the pile of sand do smart things.
And if you've spent weeks doing I/O one syscall per character, getting to the point you write hundreds of lines that way, the moment some classmate shows you that you can 100x your program's performance by batching I/O gets burned in your memory forever, in a way "I'm doing it because the manual said so" doesn't.
- TylerE 3y agoI said idiomatic because that’s the form they’re going to encounter it in the wild, in library doc, in stack overflow answers. I do t think rhe sort of low level bit banging you propose is a worthwhile use of a students time, given the vast amount they have to learn that won’t be immediately obsolete.
- samatman 3y agoI firmly disagree with this. We're talking about learning C, not learning an arbitrary programming language. The course of study the GP comment suggests teaches syscalls, pipes, buffering, and most important, it teaches mechanical sympathy. All of which are things a C programmer needs to understand. More programming tasks than you might imagine are low-level bit banging, and C remains the language of choice for doing them. It might be Zig one day, and if so, the same sort of deep-end dive into low-level detail will remain a good way to approach such a language. Far from becoming "rapidly obsolete", learning in this style will prevent this sort of mistake for years into the future: https://news.ycombinator.com/item?id=39766130 https://news.ycombinator.com/item?id=39766130
- TylerE 3y ago“we” are certainly not talking about C. I never mentioned C, nor any language. This was intentional.
- mcguire 3y agoThis is similar to the presentation in Software Tools, IIRC.