News for hackers. Stuff that matters.
Re:Templating in C by alxmdev on Saturday February 28, 2015 @03:16PM (#9124875)
Yes, but that is now a worker function that handles every if(n == x) case explicitly in the body, not something you need the preprocessor for anymore. Nothing against it, but it is a different design.
Re:Templating in C by arquivo on Saturday February 28, 2015 @03:19PM (#9124884)
I copied the function from the article, they are identical. This was done intentionally to show how convoluted the article is.
Re:Templating in C by alxmdev on Saturday February 28, 2015 @03:40PM (#9124966)
I see. I was thinking in the context of your second pastebin link and the evil_template.c snippet in the article, where the functions are actually generic (and in which case you can't avoid the function being declared as a macro unless you go the multiple-includes route).