Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #6936

Re: HEAP error when trying to use free() help needed

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: HEAP error when trying to use free() help needed
Date 2011-06-20 20:57 +1200
Message-ID <968gc6FsmeU4@mid.individual.net> (permalink)
References (1 earlier) <445a602a-ca39-4806-88bf-be5820678d7f@gv8g2000vbb.googlegroups.com> <9683f5FsmeU3@mid.individual.net> <7fea560f-f171-4fd7-ad1b-e4d97598b7e8@r2g2000vbj.googlegroups.com> <4dfee374$0$2831$7b1e8fa0@news.nbl.fi> <3a723395-a6b3-4a14-8e70-6b0e9ded7b1e@m18g2000vbl.googlegroups.com>

Show all headers | View raw


On 06/20/11 07:35 PM, none wrote:
> On Jun 20, 1:06 am, Juha Nieminen<nos...@thanks.invalid>  wrote:
>> none<none9...@hotmail.com>  wrote:
>>> It's just a simplified test of a more complex code that didn't work,
>>> I'm using just one char for the purpose of this test, but the final
>>> code will handle a string.
>>
>>    Any reason you can't use std::string or std::vector<char>? Using them
>> instead of allocating the string yourself will not only make your code
>> safer, it will also make it a lot simpler (you won't need to write a
>> copy constructor and assignment operator).
>
> In fact, I made a mistake when I said that the data was a string. The
> string will be converted into BCD values, so the data pointer will
> contain a arbitrary sized BCD number.

But why are you using malloc, or raw pointers?

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

HEAP error when trying to use free() help needed none <none9823@hotmail.com> - 2011-06-07 03:16 -0700
  Re: HEAP error when trying to use free() help needed "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2011-06-07 13:11 +0200
  Re: HEAP error when trying to use free() help needed "Balog Pal" <pasa@lib.hu> - 2011-06-07 15:18 +0200
  Re: HEAP error when trying to use free() help needed "io_x" <a@b.c.invalid> - 2011-06-07 19:50 +0200
    Re: HEAP error when trying to use free() help needed "io_x" <a@b.c.invalid> - 2011-06-09 08:48 +0200
  Re: HEAP error when trying to use free() help needed "io_x" <a@b.c.invalid> - 2011-06-08 11:11 +0200
    Re: HEAP error when trying to use free() help needed Juha Nieminen <nospam@thanks.invalid> - 2011-06-08 10:17 +0000
  Re: HEAP error when trying to use free() help needed Mustansir <mustansir.azhar@gmail.com> - 2011-06-08 06:23 -0700
  Re: HEAP error when trying to use free() help needed Krice <paulkp@mbnet.fi> - 2011-06-08 11:42 -0700
    Re: HEAP error when trying to use free() help needed Pete Becker <pete@versatilecoding.com> - 2011-06-08 08:54 -1000
  Re: HEAP error when trying to use free() help needed none <none9823@hotmail.com> - 2011-06-19 22:06 -0700
    Re: HEAP error when trying to use free() help needed Ian Collins <ian-news@hotmail.com> - 2011-06-20 17:17 +1200
      Re: HEAP error when trying to use free() help needed none <none9823@hotmail.com> - 2011-06-19 22:53 -0700
        Re: HEAP error when trying to use free() help needed Juha Nieminen <nospam@thanks.invalid> - 2011-06-20 06:06 +0000
          Re: HEAP error when trying to use free() help needed none <none9823@hotmail.com> - 2011-06-20 00:35 -0700
            Re: HEAP error when trying to use free() help needed Ian Collins <ian-news@hotmail.com> - 2011-06-20 20:57 +1200
            Re: HEAP error when trying to use free() help needed Juha Nieminen <nospam@thanks.invalid> - 2011-06-20 18:25 +0000

csiph-web