News for hackers. Stuff that matters.

arquivo

Re:Templating in C on Sunday March 01, 2015 @03:57AM (#9126480)
Re:Templating in C 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 on Saturday February 28, 2015 @02:56PM (#9124814)
There is also a version with a normal function:

http://pastebin.com/Wesjzs1A

Solution in the article is overly convoluted.

Re:Templating in C on Saturday February 28, 2015 @01:37PM (#9124543)
Take a look at Object Oriented Programming With ANSI-C.

http://www.cs.rit.edu/~ats/books/

It is complicated, but you can take parts from it and built your own system.

Re:Templating in C on Saturday February 28, 2015 @11:46AM (#9124174)
Why complicate with multiple files, functions, defines and includes; here it is in one file with a single define:

http://pastebin.com/uWSs7ca7

We can improve the macro further by removing the unnecessary if statement and the index number:

http://pastebin.com/vPTTYPpe