Title
Add <chrono> and <ratio> to freestanding implementations
Status
nad
Section
[compliance]
Submitter
BSI

Created on 2010-08-25.00:00:00 last changed 164 months ago

Messages

Date: 2011-06-02.15:28:39

Proposed resolution:

  1. Add a new entry in Table 14 — C++ library headers:

    Table 14 — C++ library headers
    <iterator>
    <library_support>
    <limits>
  2. Remove the last row [thread.threads] <threads> from Table 16 — C++ headers for freestanding implementations and insert a new one instead (To the editor: For the actual target Clause please see the comment in bullet 5 of this proposed resolution):

    Table 16 — C++ headers for freestanding implementations
    Subclause Header(s)
    [thread.threads] Threads <thread>
    ?? Library support <library_support>
  3. Modify paragraph [compliance] p. 3:

    3 The supplied version of the header <cstdlib> shall declare at least the functions abort, atexit, at_quick_exit, exit, and quick_exit (18.5). The supplied version of the header <thread> shall meet the same requirements as for a hosted implementation or including it shall have no effect. The other headers listed in this table shall meet the same requirements as for a hosted implementation. A program can detect the presence of standard headers not listed in Table 16 using the facilities provided by the <library_support> header.

  4. Remove the following line from the header <thread> synopsis in [thread.threads] p. 1:

    namespace std {
      #define __STDCPP_THREADS__ __cplusplus
    
      class thread;
      [...]
    }
    
  5. Add a new section in Clause 18 or 20 (or any other suitable place at the editor's discretion):

    ?? Library support [library.support]

    The header <library_support> defines an implementation-defined set of macros to allow a program detect the presence of standard headers in freestanding implementations. [Note: Hosted implementations shall provide all standard headers, thus shall provide all macros. — end note]

    For each standard header listed in Tables 14 (C++ library headers) and 15 (C++ headers for C library facilities) that is provided by the implementation, <library_support> shall define a macro with name _ _HAS_XXX_HEADER_ _ where XXX is replaced by the uppercase version of the name of the header. Each such macro shall expand to the value _ _cplusplus. [Example:

    #include <library_support>
    
    #ifdef _ _HAS_THREADS_HEADER_ _
      #include <threads>
      // code that exploit the presence of threads
    #else
      // fallback code that doesn't rely on threads
    #endif
    

    end example]

    No other standard header shall define macros with a name beginning with _ _HAS_ and ending with _HEADER_ _.

Date: 2011-06-02.15:28:39

Rationale:

We are not adding new headers to freestanding at this point.

Date: 2011-03-24.00:00:00

[ 2011-03-24 Madrid meeting ]

Freestanding no longer requires <thread> header

Date: 2011-03-06.00:00:00

[ 2011-03-06: Daniel observes: ]

Accepting the proposal n3256 would solve this issue.

Date: 2011-02-25.00:00:00

[ 2011-02-25: Alberto drafts wording ]

Date: 2010-10-24.22:33:31

[ Original resolution proposed by NB comment: ]

Add the <chrono> and <ratio> headers to the freestanding requirements.

It might be necessary to address scaled-down expectations of clock support in a freestanding environment, much like <thread>.

Date: 2010-10-29.16:11:50

[ Extracts from lengthy Rapperswil discussion: ]

There is a concern that this issue is a misunderstanding of the actual requirements of a free-standing implementation to support the <thread> header. In general, a free-standanding implementation will provide an empty header, specifically so that a user can test for the absence of the _ _ STDCPP_THREADS _ _ macro. This idiom as used as there is no portable way to test for the lack of a header.

At this point, it was suggested the NB comment is trying to solve the wrong problem, and that _ _ STDCPP_THREADS _ _ should be a pre-defined macro in clause 16 that can be tested before including <thread>. That would remove the need to add additional headers to the free-standanding requirements.

It is worth noting that Japan requested <ratio> as a free-standing header in their CD1 comments. No-one seemed keen to require clocks of a free-standing implementation though.

Detlef volunteers to look at a way to redraft 17.6.1.3 p3.

Date: 2010-10-24.22:33:31

Addresses GB-55

The <thread> header uses duration types, found in the <chrono> header, and which rely on the ratio types declared in the <ratio> header.

History
Date User Action Args
2011-06-02 15:28:39adminsetmessages: + msg5803
2011-03-24 15:58:06adminsetmessages: + msg5679
2011-03-24 15:58:06adminsetstatus: open -> nad
2011-03-06 19:27:01adminsetmessages: + msg5624
2011-02-25 00:14:19adminsetmessages: + msg5544
2011-02-25 00:14:19adminsetmessages: + msg5543
2010-10-24 22:33:31adminsetmessages: + msg5065
2010-10-24 22:33:31adminsetmessages: + msg5064
2010-10-24 10:50:39adminsetmessages: + msg4988
2010-08-25 00:00:00admincreate