cgccvector

What are Vectors and < > in C?


I was looking at the source code for gcc (out of curiosity), and I noticed a data structure that I've never seen in C before.

At line 80 and 129 (and many other places) in the parser, they seem to be using vectors.

80:  vec<tree> incomplete_record_decls;
129: ridpointers = ggc_cleared_vec_alloc<tree> ((int) RID_MAX);

I've never encountered this data type in C, nor these: < >. Are they native to C?

Does anyone know what they are and how they are used?


Solution

  • GCC has moved from C to C++ since GCC 4.8

    GCC now uses C++ as its implementation language. This means that to build GCC from sources, you will need a C++ compiler that understands C++ 2003. For more details on the rationale and specific changes, please refer to the C++ conversion page.

    GCC 4.8 Release Series - Changes, New Features, and Fixes

    The work has actually begun long before that, with the creation of gcc-in-cxx branch. The developers first tried to compile the source code with a C++ compiler, so there weren't any name changes. I guess they didn't bother to rename the files later when merging the two branches and officially have only one C++ branch

    You can read GCC's move to C++ for more historical information