On 11/3/2014 2:28 PM, Steven Schveighoffer wrote:
I had a very nasty experience with using a template-based API. I vowed to avoid
it wherever possible.

The culprit was std::string -- it changed something internally from one version
of libc++ to the next on Linux. So I had to recompile everything, but the whole
system I was using was with .so objects.

templates do NOT make good API types IMO.

It seems this is blaming templates for a different problem.

If I have:

  struct S { int x; };

in my C .h file, and I change it to:

  struct S { int x,y; };

Then all my API functions that take S as a value argument will require recompilation of any code that uses it.

Would you conclude that C sux for making APIs? Of course not. You'd say that a stable API should use reference types, not value types.

Having templates or not is irrelevant.

Reply via email to