Lesser known tricks, quirks and features of C
blog.joren.ga
Lesser known tricks, quirks and features of C
1–10 of 189 posts
Re: Lesser known tricks, quirks and features of C
#2Re: Lesser known tricks, quirks and features of C
#3Re: Lesser known tricks, quirks and features of C
#41. %n in printf would be handy when writing CLIs dealing w/ multiple lines or precise counts of backspaces.
2. Using enums as a form of static_assert() is a great idea (triggering a div by zero compiler error).
Re: Lesser known tricks, quirks and features of C
#5Re: Lesser known tricks, quirks and features of C
#6Mazda cars used to have a bug where they used printf(str) instead of printf("%s", str) and their media system would crash if you tried to play the "99% Invisible" podcast in them. All because the "% In" was parsed as a "%n" with some extra modifiers. https://99percentinvisible.org/episode/the-roman-mars-mazda-...
Re: Lesser known tricks, quirks and features of C
#7I didn’t know C23 was getting rid of trigraphs. That’s probably a good thing and easy to clean up if needed.
Re: Lesser known tricks, quirks and features of C
#8This isn't correct since int can't be less than 16-bits. Fields are placed on the nearest natural alignment for the target platform, which might not support unaligned access.
Re: Lesser known tricks, quirks and features of C
#9Re: Lesser known tricks, quirks and features of C
#10for (unsigned int i = N; i --> 0;) printf("%d\n", i);
This --> construction also works in JavaScript and so on.