Jens Gustedt's Blog

December 4, 2012

inline functions as good as templates

Filed under: C11, C99, compiler optimization, library — Jens Gustedt @ 23:24

I recently started to implement parts of the “Bounds checking interfaces” of C11 (Annex K) for P99 and observed a nice property of my implementation of qsort_s. Since for P99 basically all functions are inlined, my compilers (gcc and clang) are able to integrate the comparison functions completely into the sorting code, just as an equivalent implementation in C++ would achieve with template code.

(more…)

Create a free website or blog at WordPress.com.