Click here to Skip to main content
16,004,301 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ListBox SDI SetFont Pin
_chew1-Apr-08 17:01
_chew1-Apr-08 17:01 
GeneralRe: ListBox SDI SetFont Pin
Mark Salsbery1-Apr-08 19:22
Mark Salsbery1-Apr-08 19:22 
GeneralRe: ListBox SDI SetFont Pin
Hamid_RT7-Apr-08 3:37
Hamid_RT7-Apr-08 3:37 
Generalauto_ptr array Pin
George_George1-Apr-08 0:50
George_George1-Apr-08 0:50 
GeneralRe: auto_ptr array Pin
_AnsHUMAN_ 1-Apr-08 0:59
_AnsHUMAN_ 1-Apr-08 0:59 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 1:41
George_George1-Apr-08 1:41 
GeneralRe: auto_ptr array Pin
CPallini1-Apr-08 1:55
mveCPallini1-Apr-08 1:55 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 2:03
George_George1-Apr-08 2:03 
Hi, CPallini,


1.

CPallini wrote:
George_George wrote:
Because the destructor of auto_ptr will use delete other than delete[]. And it will lead to memory leak.


FALSE. It allocates just 1 integer (and initialise it to 10) hence no memory leaks after delete.


I am confused. We are talking about destructor of auto_ptr? Why do you say "allocates"?? Could you provide more description please? Smile | :)

2.

CPallini wrote:
BTW: no compiler error for the code below

auto_ptr<int[10]> pi(new int[10]);


No, I have compile errors in MSVC 2008.

1>Compiling...
1>main.cpp
1>d:\visual studio 2008\projects\test0401\test0401\main.cpp(7) : error C2664: 'std::auto_ptr<_Ty>::auto_ptr(_Ty (*)) throw()' : cannot convert parameter 1 from 'int *' to 'int (*)[10]'
1>        with
1>        [
1>            _Ty=int [10]
1>        ]
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast



regards,
George
GeneralRe: auto_ptr array Pin
CPallini1-Apr-08 2:17
mveCPallini1-Apr-08 2:17 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 2:22
George_George1-Apr-08 2:22 
GeneralRe: auto_ptr array Pin
CPallini1-Apr-08 2:28
mveCPallini1-Apr-08 2:28 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 2:54
George_George1-Apr-08 2:54 
GeneralRe: auto_ptr array Pin
CPallini1-Apr-08 3:01
mveCPallini1-Apr-08 3:01 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 3:16
George_George1-Apr-08 3:16 
GeneralRe: auto_ptr array Pin
CPallini1-Apr-08 4:09
mveCPallini1-Apr-08 4:09 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 4:19
George_George1-Apr-08 4:19 
GeneralRe: auto_ptr array Pin
led mike1-Apr-08 4:24
led mike1-Apr-08 4:24 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 4:37
George_George1-Apr-08 4:37 
GeneralRe: auto_ptr array Pin
led mike1-Apr-08 5:07
led mike1-Apr-08 5:07 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 19:38
George_George1-Apr-08 19:38 
GeneralRe: auto_ptr array Pin
led mike2-Apr-08 5:01
led mike2-Apr-08 5:01 
GeneralRe: auto_ptr array Pin
George_George2-Apr-08 23:38
George_George2-Apr-08 23:38 
JokeRe: auto_ptr array Pin
Cedric Moonen1-Apr-08 4:40
Cedric Moonen1-Apr-08 4:40 
GeneralRe: auto_ptr array Pin
George_George1-Apr-08 19:40
George_George1-Apr-08 19:40 
GeneralRe: auto_ptr array [modified] Pin
CPallini1-Apr-08 4:47
mveCPallini1-Apr-08 4:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.