Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

G++ 4.3, auto_ptr deprecated, no unique_ptr, what I'm supposed to do?

631 views
Skip to first unread message

rkadeFR

unread,
Apr 22, 2013, 5:48:36 PM4/22/13
to
Hi,

I'm programming with G++ 4.3, and the compiler warn me about the
deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3, so
what I'm supposed to do ?


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Daniel Krügler

unread,
Apr 23, 2013, 12:30:09 AM4/23/13
to
Am 22.04.2013 23:48, schrieb rkadeFR:
> I'm programming with G++ 4.3, and the compiler warn me about the
> deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3, so
> what I'm supposed to do ?

If g++ 4.3 deprecates std::auto_ptr without introducing std::unique_ptr,
this looks weird to me. I suggest to use a newer compiler version.

HTH & Greetings from Bremen,

Daniel Krügler

Francis Glassborow

unread,
Apr 23, 2013, 5:25:15 AM4/23/13
to
On 22/04/2013 22:48, rkadeFR wrote:
> Hi,
>
> I'm programming with G++ 4.3, and the compiler warn me about the
> deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3, so
> what I'm supposed to do ?

Get 4.7 or 4.8 it isn't as if it costs money :)

Francis

rkadeFR

unread,
Apr 23, 2013, 5:30:32 AM4/23/13
to
On 23/04/2013 06:30, Daniel Kr�gler wrote:
> Am 22.04.2013 23:48, schrieb rkadeFR:
>> I'm programming with G++ 4.3, and the compiler warn me about the
>> deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3,
>> so what I'm supposed to do ?
>
> If g++ 4.3 deprecates std::auto_ptr without introducing
> std::unique_ptr, this looks weird to me. I suggest to use a newer
> compiler version.

Thank you, but I can't use a newer version of my compiler.

That looked weird to me at first, so I searched here if the feature
was implemented: gcc.gnu.org/gcc-4.3/cxx0x_status.html. Then I looked
again in the sources file in /usr/include/c++/4.3, and I didn't find
any unique_ptr implementation.

So I'm using the auto_ptr so far.

Maurizio Loreti

unread,
Apr 23, 2013, 11:29:25 AM4/23/13
to

Francis Glassborow <francis.g...@btinternet.com> writes:

> Get 4.7 or 4.8 it isn't as if it costs money :)

... or try -std=c++0x or -std=c++11 or whatever 4.3 needs to grok
unique_ptr (the defaule being, IIRC, -std=c++98).

--
(@_ | Maurizio Loreti
//\ |
V_/_ | EMail/ROT13: Znhevmv...@tznvy.pbz

Chris Vine

unread,
Apr 23, 2013, 8:15:41 PM4/23/13
to
On Tue, 23 Apr 2013 02:30:32 -0700 (PDT)
rkadeFR <con...@rkade.fr> wrote:

> On 23/04/2013 06:30, Daniel Kr�gler wrote:
> > Am 22.04.2013 23:48, schrieb rkadeFR:
> >> I'm programming with G++ 4.3, and the compiler warn me about the
> >> deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3,
> >> so what I'm supposed to do ?
> >
> > If g++ 4.3 deprecates std::auto_ptr without introducing
> > std::unique_ptr, this looks weird to me. I suggest to use a newer
> > compiler version.
>
> Thank you, but I can't use a newer version of my compiler.
>
> That looked weird to me at first, so I searched here if the feature
> was implemented: gcc.gnu.org/gcc-4.3/cxx0x_status.html. Then I looked
> again in the sources file in /usr/include/c++/4.3, and I didn't find
> any unique_ptr implementation.
>
> So I'm using the auto_ptr so far.

Are you using libstdc++ as it came with gcc-4.3? (It is the standard
C++ library which is emitting this warning.) Otherwise I don't
understand your report, as many moons ago I used gcc-4.3, and it
didn't exhibit this (at least when compiling for c++98/03, I don't
think I ever tried the -c++0x flag with that compiler).

Anyway, if the deprecation warnings bother you, you can always compile
with the -Wno-deprecated flag.

Chris

rkadeFR

unread,
Apr 24, 2013, 9:19:59 AM4/24/13
to
{ Please limit your quoting to the minimum needed to establish context;
quoted signature removed -mod }

On 04/24/2013 02:15 AM, Chris Vine wrote:
> On Tue, 23 Apr 2013 02:30:32 -0700 (PDT)
> rkadeFR<con...@rkade.fr> wrote:
>
>> On 23/04/2013 06:30, Daniel Krügler wrote:
>>> Am 22.04.2013 23:48, schrieb rkadeFR:
>>>> I'm programming with G++ 4.3, and the compiler warn me about the
>>>> deprecation of auto_ptr. But there isn't any unique_ptr in G++
>>>> 4.3, so what I'm supposed to do ?
>>>
>>> If g++ 4.3 deprecates std::auto_ptr without introducing
>>> std::unique_ptr, this looks weird to me. I suggest to use a newer
>>> compiler version.
>>
>> Thank you, but I can't use a newer version of my compiler.
>>
>> That looked weird to me at first, so I searched here if the feature
>> was implemented: gcc.gnu.org/gcc-4.3/cxx0x_status.html. Then I
>> looked again in the sources file in /usr/include/c++/4.3, and I
>> didn't find any unique_ptr implementation.
>>
>> So I'm using the auto_ptr so far.
>
> Are you using libstdc++ as it came with gcc-4.3? (It is the
> standard C++ library which is emitting this warning.) Otherwise I
> don't understand your report, as many moons ago I used gcc-4.3, and
> it didn't exhibit this (at least when compiling for c++98/03, I
> don't think I ever tried the -c++0x flag with that compiler).
>
> Anyway, if the deprecation warnings bother you, you can always
> compile with the -Wno-deprecated flag.

Yes I'm using libstdc++ (perhap's I should have posted in comp.std.c++
by the way, sorry about that).

{ No; your question is not about the C++ standard, but about a
practical issue with a widely used implementation -mod }

I'm compiling with the c++0x (there is no c++11 if I'm right in g++4.3).

I will add the -Wno-deprecated flag.

Thank you

-- rkadeFR

rkadeFR

unread,
Apr 29, 2013, 12:15:24 PM4/29/13
to
{ Please avoid top-posting. Reformatted by mod. -mod }

On 23/04/2013 06:30, Daniel Kr�gler wrote:
> Am 22.04.2013 23:48, schrieb rkadeFR:
>> I'm programming with G++ 4.3, and the compiler warn me about the
>> deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3, so
>> what I'm supposed to do ?
>
> If g++ 4.3 deprecates std::auto_ptr without introducing std::unique_ptr,
> this looks weird to me. I suggest to use a newer compiler version.

My bad, I just figure out that the shared_ptr are under std::tr1::, in
the tr1/memory header.

Problem solved.

Thank you,

rkadeFR

unread,
Apr 29, 2013, 5:08:22 PM4/29/13
to
On 29/04/2013 18:15, rkadeFR wrote:
> { Please avoid top-posting. Reformatted by mod. -mod }
>
> On 23/04/2013 06:30, Daniel Kr�gler wrote:
>> Am 22.04.2013 23:48, schrieb rkadeFR:
>>> I'm programming with G++ 4.3, and the compiler warn me about the
>>> deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3, so
>>> what I'm supposed to do ?
>>
>> If g++ 4.3 deprecates std::auto_ptr without introducing std::unique_ptr,
>> this looks weird to me. I suggest to use a newer compiler version.
>
> My bad, I just figure out that the shared_ptr are under std::tr1::, in
> the tr1/memory header.
>
> Problem solved.
>
> Thank you,

I'm confused today. I'm still searching the unique_ptr, not the
shared_ptr as I mentioned before.

Öö Tiib

unread,
Apr 30, 2013, 2:54:42 AM4/30/13
to
On Tuesday, 30 April 2013 00:08:22 UTC+3, rkadeFR wrote:
> On 29/04/2013 18:15, rkadeFR wrote:
> > On 23/04/2013 06:30, Daniel Kr�gler wrote:
> >> Am 22.04.2013 23:48, schrieb rkadeFR:
> >>> I'm programming with G++ 4.3, and the compiler warn me about the
> >>> deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3, so
> >>> what I'm supposed to do ?
> >>
> >> If g++ 4.3 deprecates std::auto_ptr without introducing std::unique_ptr,
> >> this looks weird to me. I suggest to use a newer compiler version.
> >
> > My bad, I just figure out that the shared_ptr are under std::tr1::, in
> > the tr1/memory header.
> >
> > Problem solved.
>
> I'm confused today. I'm still searching the unique_ptr, not the
> shared_ptr as I mentioned before.

The unique_ptr is documented as 'missing' from <memory> of libstdc++
shipped with g++ 4.3. You can use auto_ptr or take fitting smart
pointer from some other library (like boost::scoped_ptr) if you can
not upgrade to some more recent g++ version.

Daniel Krügler

unread,
Apr 30, 2013, 2:54:18 AM4/30/13
to
Am 29.04.2013 23:08, schrieb rkadeFR:
> On 29/04/2013 18:15, rkadeFR wrote:
>> On 23/04/2013 06:30, Daniel Kr�gler wrote:
>>> Am 22.04.2013 23:48, schrieb rkadeFR:
>>>> I'm programming with G++ 4.3, and the compiler warn me about the
>>>> deprecation of auto_ptr. But there isn't any unique_ptr in G++ 4.3, so
>>>> what I'm supposed to do ?
>>>
>>> If g++ 4.3 deprecates std::auto_ptr without introducing std::unique_ptr,
>>> this looks weird to me. I suggest to use a newer compiler version.
>>
>> My bad, I just figure out that the shared_ptr are under std::tr1::, in
>> the tr1/memory header.
>>
>> Problem solved.
>>
> I'm confused today. I'm still searching the unique_ptr, not the
> shared_ptr as I mentioned before.

unique_ptr had not been part of TR1, therefore I would not expect that
you find it in namespace std::tr1. You really should use a new version
of gcc, which has fixed this problem.

HTH & Greetings from Bremen,

Daniel Kr�gler
0 new messages