Bug 36428 - std::tr1 Header Location
Summary: std::tr1 Header Location
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-03 08:17 UTC by christopher kormanyos
Modified: 2008-06-05 12:24 UTC (History)
1 user (show)

See Also:
Host: i686-pc-cygwin
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description christopher kormanyos 2008-06-03 08:17:43 UTC
The standard defines headers such as <array>, <regex>, <tuple>, etc. When using std::tr1::array<T, n> the developer must include <tr1/array>. It seems like this is not consistent with the standard which would indicate that <array> is the correct include path.

When writing a cross project for GCC / DevStudio the developer is forced to do something like this: 

#if defined(_MSC_VER) 
  #include <array> 
#elif defined(__GNUC__) 
  #include <tr1/array> 
#endif 

It's ugly! And I suspect that GCC might actually have the wrong include location for std::tr1 headers.

The community does not want this kind of difference. Furthermore it is unacceptable to extend the compiler include path with some sort of a -I command line argument because this would simply lead to non-portable build mechanisms. Rather, the problem should be resolved by changing the compiler's internal include path.

Thank you. Sincerely, Chris.
Comment 1 Paolo Carlini 2008-06-03 09:17:43 UTC
This is known. At the right time we debated this issue and in fact some people commented that probably TR1 (n1836) should have more conveniently specified <tr1/*>. In any case, also given the status of TR1 of technical report (*not* standard) on the way of the next (so called C++0x) standard, which is the main focus now, while TR1 is in regression fixes-only mode, we are not going to change the paths now, breaking all *our* existing users.

By the way, in C++0x mode, the path is <array>. per the current working drafts.
Comment 2 christopher kormanyos 2008-06-05 08:21:04 UTC
OK now I understand your strategy. Thanks for the explaination.

But there is still a problem in the community. Two very popular compilers (VC and GCC) which are often used in cross development projects together now have different include paths for the C++ tr1 stuff. And it seems like support for tr1 must exist for quite some time until the transition to c++0x is complete.

We have discussed this with a few other developers and we wonder if it would be possible to somehow add <tr1> to the include path based on a new compiler switch. Perhaps there could be an additional compiler switch like std=c++98tr1. This would allow for code-compatibility when using tr1 and simultaneously allow the build system to be independent of the compiler location. Could this be considered as a change request?

Thank you for your consideration.

Sincerely, Chris.
Comment 3 Andrew Pinski 2008-06-05 12:24:56 UTC
Use -std=c++0x if you want them in the "correct" location.  They are only part of the C++0x standard and not part of C++98/03 standards.