Generic programming: Difference between revisions

Content deleted Content added
m Duplicate word removed
Line 667:
[[VHDL]], being derived from Ada, also has generic abilities.<ref>https://www.ics.uci.edu/~jmoorkan/vhdlref/generics.html VHDL Reference</ref>
 
[[C (programming language)|C]] has a feature called "type-generic expressions" using the {{c-lang|_Generic}} keyword:<ref name="N1516">[https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1516.pdf WG14 N1516 Committee Draft — October 4, 2010]</ref> This feature gives c [[function overloading]] capabilities, but is not related to to generic programming. Generic programming can be achieve by using the proprocessor to define the generic code, with macro expansion taking the role of ''instantiation''. Sometimes the non-standard extention "statement expressions" is used to simulate function like behaviour for generic code:
<syntaxhighlight lang="c">
#define max(a,b) \