This is the mail archive of the gcc-patches@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]

Re: [C++ Patch] Define __cplusplus == 201300L for -std=c++1y


2013/4/26 Daniel Krügler <daniel.kruegler@gmail.com>:
> 2013/4/26 Daniel Krügler <daniel.kruegler@gmail.com>:
>> 2013/4/26 Paolo Carlini <paolo.carlini@oracle.com>:
>>> Hi,
>>>
>>> On 04/26/2013 12:42 PM, Jakub Jelinek wrote:
>>>>
>>>> On Fri, Apr 26, 2013 at 12:32:40PM +0200, Paolo Carlini wrote:
>>>>>
>>>>> On 04/24/2013 08:20 PM, Jason Merrill wrote:
>>>>>>
>>>>>> On 04/24/2013 02:02 PM, Paolo Carlini wrote:
>>>>>>>
>>>>>>> +#if __cplusplus < 201300L
>>>>>>
>>>>>> Don't test for this value.  Use <= 201103L instead.
>>>>>>
>>>>>> OK with that change.
>>>>>
>>>>> Thanks Jason.
>>>>>
>>>>> Today I'm noticing an issue with the underlying <stdio> from glibc,
>>>>> which makes our <cstdio> unusable. It does have:
>>>>>
>>>>> #if !defined __USE_ISOC11 \
>>>>>      || (defined __cplusplus && __cplusplus <= 201103L)
>>>>> /* Get a newline-terminated string from stdin, removing the newline.
>>>>>     DO NOT USE THIS FUNCTION!!  There is no limit on how much it will
>>>>> read.
>>>>>
>>>>>     The function has been officially removed in ISO C11.  This
>>>>> opportunity
>>>>>     is used to also remove it from the GNU feature list.  It is now only
>>>>>     available when explicitly using an old ISO C, Unix, or POSIX
>>>>> standard.
>>>>>     GCC defines _GNU_SOURCE when building C++ code and the function is
>>>>> still
>>>>>     in C++11, so it is also available for C++.
>>>>>
>>>>>     This function is a possible cancellation point and therefore not
>>>>>     marked with __THROW.  */
>>>>> extern char *gets (char *__s) __wur __attribute_deprecated__;
>>>>>
>>>>> I don't think the header should check __cplusplus <= 201103L like
>>>>> that. Jakub, Jason, what do you think?
>>>>
>>>> I guess Ulrich added this with the expectation that gets will be also
>>>> removed from C++1y.  Has there been any discussions regarding that in the
>>>> WG
>>>> already?
>>>
>>> Not to my best knowledge. I'm adding in CC Jonathan and Daniel too.
>>>
>>> We could certainly mirror in the C++ library what glibc does, but at this
>>> point it seems premature to me to assume that C++1y (C++14, in practice)
>>> will be stricter than C++11 as regards gets.
>>
>> Jonathan recently submitted an LWG issue for this (not yet part of the
>> available list). I'm in the process to add the new issue within the
>> following days. He's essentially suggesting to remove get() from
>> C++14.
>
> To clarify this: The C++ Standard currently refers to a get() function
> that does not exist anymore in the reference C99. So, its removal
> looks more than reasonable to me.

Sorry, I need to correct me here: gets() is part of C99 TC3, but has
been deprecated.

>> - Daniel
>>
>>> Paolo.


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