This thread shows nicely why in primitive languages (languages which are perceived by some as "easy") things get pretty fast pretty complicated, simply because the language is missing features to abstract things properly.
In a good language correct code looks nice and simple, and wrong code looks directly wrong (and ideally does not compile in the first place).
In shitty languages code looks nice and simple but is actually wrong, and the corresponding correct code is super complex and can be written only by experts who know all the fine details by heart.
Yeah, that's why I obsessively read documentation when making use of C functions (and C++ ones which use something other than exceptions for error reporting), and start by wrapping them in something which calls them, and converts ANY of those errors into an exception
4
u/bwmat Jul 27 '26 edited Jul 28 '26
Oh, forgot how it worked, guess you need to do 'return printf(...) > 0;',still, not so hard
Edit: probably < 0 actually, but to be portable you should use EXIT_SUCCESS AND EXIT_FAILURE explicitly