C ++ GCC / MinGW paths: ssp, ext, tr1; parallel, ext, bit, experimental

Question:

In the GCC / MinGW folder tree there are duplicates of some header file names in folders: ssp, ext, tr1; parallel, ext, bit and experimental ...

Should you avoid explicit "include" directives for these folders in production code - as a best practice ?

OR, is there any online documentation regarding legitimate scripts, should these folders be explicitly used in #include statements?

Notes: 1. SSP: (Stack Shock Protection) 2. tr1: Tech Report 1, ( Stack Link ) seems outdated.

Tool chain:

C ++ 11 and C ++ 14:

Eclipse CDT using Clang ToolChain , Google Test API and MinGW (5.1).

At the time of this post, Clang LibC ++ is not yet built for Windows, so with MinGW: Posix, SEH, X86_64, bundle.

<stdio.h>

Folders:

  • include /stdio.h
  • include / c ++ / TR1 / stdio.h
  • Library / gcc / x86_0w64-mingw32 / 5.1.0 / include / ssp / stdio.h

<algorithm>

Folders:

  1. include / c ++ / algorithm
  2. include / c ++ / experimental / algorithm
  3. enable / c ++ / int / algorithm
  4. include / c ++ / parallel / algorithm
+3


source to share


1 answer


(move / expand from comments)

I've always seen stuff included explicitly from these places, for example. <bits/c++config.h>

, <ext/bitmap_allocator.h>

, <tr1/cmath>

Etc., never adding one of these directories directly to the include search path. Note that as far as I understood, the bit directory should mostly be left alone as it contains implementation-specific versions (not necessarily persistent APIs). I can't find explicit documentation on this, but the overall library structure (with the standard public headers at the root, which includes their mappings bits

) seems to suggest this.

Should they be avoided as best practice? Or, what are the scripts they should be using?

Except bits

, all others can be used as long as you agree that you depend on libstdc++

, not just standard C ++ as stated in the documentation at http://gcc.gnu.org/onlinedocs/libstdc++/manual/using_headers. html :

"Less custom" stuff is what you'll find in tr1

; it comes from C ++ TR1 , which is not a "real" standard, but guidelines for materials to be included in the then C ++ 11 standard; before 2011 you could use it and expect some level of compatibility with other compilers, today you can safely ignore it and just use C ++ 11 (which is actually standardized and slightly different in some details).



All ext

are extensions of libstdC ++, some of them are SGI STL, some are newer; it is possible that some of them will be included in some C ++ standard clause, but in that case they will probably go elsewhere.

The directory parallel

contains parallel implementations of some classic STL algorithms ( details here ); again, there is a proposal in the IIRC to standardize them, but as above, I expect them to move somewhere else if standardized, since rarely standardization leaves proposals intact and they need a way that allows older programs to work fine with old headers / semantics.

experimental

contains material for new experimental technical specifications (concept similar to TR1), which should end in a "real" standard library when new standards are released; at this point in my install gcc 4.9.2 I can find string_view

and optional

there, but should see some other material ; personally, as with tr1, I would wait for the wave to settle in the new standard before using these headers in production code, because since they are, they are still the driving goal and the quality of the code is not comparable to the rest library (these are still experimental stuff, as the title says).

The folder ssp

contains Stack Smashing Protector material. From OSDev, ( Link ):

Compilers such as GCC allow this feature to be requested through compiler options or if the compiler vendor has enabled it by default. It is worth considering enabling it by default if your operating system is security conscious and you are providing support.

+2


source







All Articles