2

I am a programming student and have occasionally encountered references to: Generic C, does this mean just plain classic C?

"generic c/c++ implementations for commonly used data structures in any serious piece of software"

It typically appears in contexts such as this; I am pretty sure that I have simply been misreading such references as (generic c)/c++ rather than: generic (c/c++). it looks like it is probably referring to a set of libraries. Thanks for all your replies.

1 Answers1

3

generic c/c++ implementations for commonly used data structures in any serious piece of software"

Here, generic and c/c++ are just distinct adjectives listed in front of implementations of data structures; could equivalently have said "c/c++ generic implementations..." or "generic implementation in c/c++" etc.. Data structures such as lists and binary trees are commonly used for arbitrary data types like int, double and user-defined structures. Implementations that allow the data structure code to be reused for arbitrary types are called "generic" implementations.

In C, examples are the standard library's binary search and quick sort functions, which accept data without understanding the content of the memory, as well as pointers to functions to call to perform meaningful interpretation of the data. See http://www.cplusplus.com/reference/cstdlib/qsort/ and http://www.cplusplus.com/reference/cstdlib/bsearch/

In C++, templates provide better support for generic data structures, with the Standard Library hosting generic vectors, lists, (binary tree associative) maps, double-ended queues, stacks, more recently hash tables termed unordered_maps etc..

Tony Delroy
  • 102,968
  • 15
  • 177
  • 252