C for all: Parametric polymorphism in C
plg.uwaterloo.ca
plg.uwaterloo.ca
Hey, thanks for the credit.
Tangentially related - once you worked with C long enough, the lack of of "templates" becomes pretty obvious. If you need two functions that do the same thing for two different input types, you have two options - wrap it into a multiline define or use one generic function and use a callback to deal with type differences, a'la qsort(). Neither is exactly ideal.
Does anyone know of C dialects with some form of template support?
C++, but I'm sure it's not the answer you want.
It would be nice if C++ compilers had more fine grained switch to activate only functionality people want to use. It would be better, IMHO, than creating a new incompatible language each time. A "C + template" would be useful for many people who don't want the full C++.
The biggest problem with using full C++ as C + <small subset of C++ features> is that at some point people will stop writing in C style and start to use STL and design code using C++ idioms. You can probably try to fight this with coding standards, linters and other tools but policing people will require some additional effort.
Parametric polymorphism is something every statically typed programming language should have in 2015. I'm aware templates aren't quite parametrically polymorphic, but it's still better than nothing.
CS343 uses uC++ which has coroutines, threads, monitors and other constructs used to teach advanced control flow.
[0] http://plg.uwaterloo.ca/~usystem/uC++.html
[1] https://www.student.cs.uwaterloo.ca/~cs343/
[2] http://plg.uwaterloo.ca/~usystem/pub/uSystem/uC++book.pdf
The text refers to a C9x standard, so it must predate the standardization of C99.
C powers the daemons and operating systems of the world.
When you're working in the field, C's transparency and absence of esoteric programming voodoo is a feature, not deficit.
Interest posting made today similar: https://news.ycombinator.com/item?id=9827051
You shouldn't ever run into a situation where you'd tell your fellow programmer, "Hey, on line 300 here, you're doing UB, stop it", only for them to say "No, I'll do UB if I please".
With C++ on the other hand, you could very well run into situations where you plead with your fellow programmer, e.g., "please stop overloading operators in this opaque and unmaintainable way", and then they tell you, "so what, that's our in-house style and it has official language blessing".
Also, you'd be surprised how many stubborn C programmers apparently think that mutable global variables are an excellent and convenient time-saver. (Not that C++ programmers do inherently any better here, cf. Singleton)