Rewriting Libimagequant in Rust for Portability
Lots of extreme generalisations and exaggerations of the situation with C. It&#x27;s great that you like rust and want to write your code in it, I don&#x27;t really care at the end of the day, but vague statements such are not very useful or productive.<p>&gt;There&#x27;s no standard for building C programs.<p>Is there a written standard for compiling rust programs? I don&#x27;t think so. Rust doesn&#x27;t do standards after all.<p>Jokes aside, this is basically irrelevant. Why does there need to be a standard for building C programs? Making something build across platforms (including cross compilation to other platforms) has been solved by everyone and their grandmother at this point. This means that aside from taking the route of re-implementing it yourself (not particularly difficult) you have literally dozens of perfectly good options to chose from.<p>In fact, most of this rant sounds like it stems from your dislike of OpenMP not C.<p>&gt;I could have kept the library in C and replaced OpenMP with some other solution instead, but I wasn&#x27;t keen on reinventing this wheel. Even basic things like spawning a thread run into C&#x27;s portability woes.<p>Thankfully, you don&#x27;t need to reinvent the wheel, the problem of cross platform multiprocessing in C has been solved at least a dozen times by now. It should be trivial to use one of these many options (or even write your own, even if you don&#x27;t like the idea of &quot;reinventing the wheel&quot; it&#x27;s certainly not particularly difficult either and can likely be lighter than any other more general option).<p>&gt;The platonic ideal portable C exists only as a hypothetical construct in the C standard. The C that exists in the real world is whatever Microsoft, Apple, and others have shipped. That C is a mess of vendor-specific toolchains, each with its own way of doing things, missing features, broken headers, and leaky abstractions. Shouting &quot;it&#x27;s not C&#x27;s fault, screw &lt;insert vendor name&gt;!&quot; doesn&#x27;t solve the problem, but switching to Rust does.<p>I mean, rust is hardly helping you here. There&#x27;s one implementation of rust doing their own thing so far, nothing stops anyone from making this situation as &quot;bad&quot; as in C. You may as well just say you only support clang or only support GCC and base your project around that assumption. In fact, if you&#x27;re making the mistake of trying to support a microsoft compiler then I would argue that you&#x27;ve made your life difficult for no reason and blamed it on C.<p>&gt;dreadful state of C dependency management did.<p>Hardly any more dreadful than rust&#x27;s solution to the problem.