This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

using C++ STL containers in GCC/gfortran source code


Hi all,

I recently ran into some discussion with Jakub about using std::string
in gfortran (see PR 78822), which got me curious about some general
points ...

What I'd like to know is: In the current state of things in GCC, is it
possible/reasonable to use any of the STL containers (like
std::vector, std::string, whatever) in GCC and its front ends (in
particular gfortran)?

That question has two parts:
1) Is it technically possible at all? Are there drawbacks/pitfalls?
(In particular Jakub mentioned possible memory management issues, i.e.
xmalloc vs malloc etc.)
2) If technically possible, is it encouraged? I didn't find any
statement about STL in the GCC coding conventions
(https://gcc.gnu.org/codingconventions.html).

Looking through the current GCC code base, it seems that mostly the Go
FE is making extensive use of the things like std::string and
std::vector, while other parts only use such things rarely.

Basically the only STL construct used in the Fortran FE right now
seems to be std::swap, and a single instance of std::map in
trans-common.c. Would there be a general problem with using
std::string in gfortran?

Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]