Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Libraries Pin
Zizilamoroso11-Sep-03 0:13
Zizilamoroso11-Sep-03 0:13 
GeneralRe: Libraries Pin
jhwurmbach11-Sep-03 1:16
jhwurmbach11-Sep-03 1:16 
GeneralRe: Libraries Pin
Zizilamoroso11-Sep-03 2:08
Zizilamoroso11-Sep-03 2:08 
GeneralRe: Libraries Pin
jhwurmbach11-Sep-03 2:10
jhwurmbach11-Sep-03 2:10 
GeneralDialog Help Pin
10-Sep-03 23:23
suss10-Sep-03 23:23 
GeneralRe: Dialog Help Pin
Iain Clarke, Warrior Programmer10-Sep-03 23:44
Iain Clarke, Warrior Programmer10-Sep-03 23:44 
GeneralSDI linkage with dialog Pin
coda_x10-Sep-03 23:21
coda_x10-Sep-03 23:21 
GeneralHorrid Memory Management Issue Pin
Dangleberry10-Sep-03 22:30
sussDangleberry10-Sep-03 22:30 
Hi all, back with a slightly different issue. OK, here's what I'm trying to do:

I'm writing a template container class for a dynamic array (similar to the vector class). The class will be used as a basis for my own custom string allocation and more complex class structures. With this in mind, operator new in its standard form has not been implemented because it cannot be used to expand memory, I would, in effect, have to new another block of memory and copy the contents over before deleting the old block, this is slow and prone to mistakes. Therefore malloc has been implemented, with realloc, to handle the actual memory allocations. However, the problem with malloc is that it never calls the constructor for the object you want to store, it just allocates raw bytes. BUT, does this mean I could use placement new to initialise a block of memory with type T as follows:

<br />
T* p = malloc(sizeof(T));<br />
if(p)<br />
{<br />
  new (p) T;<br />
}<br />


I would like to be able to call the constructor for each object in the malloc'ated area but similarly I can't use new cos I want it to be fast AND dynamic. Any good links, ideas, suggestions on how I'm going about this would be very much appreciated. This class will be a foundation for many things and I need it to be neat, at the moment it works, but its buggy cos things aren't getting constructed properly. Thanks guys.
GeneralRe: Horrid Memory Management Issue Pin
Phil Speller10-Sep-03 23:20
Phil Speller10-Sep-03 23:20 
GeneralRe: Horrid Memory Management Issue Pin
Dangleberry10-Sep-03 23:59
sussDangleberry10-Sep-03 23:59 
GeneralRe: Horrid Memory Management Issue Pin
Phil Speller11-Sep-03 1:37
Phil Speller11-Sep-03 1:37 
GeneralRe: Horrid Memory Management Issue Pin
Dangleberry11-Sep-03 2:31
sussDangleberry11-Sep-03 2:31 
GeneralRe: Horrid Memory Management Issue Pin
Phil Speller10-Sep-03 23:50
Phil Speller10-Sep-03 23:50 
GeneralRe: Horrid Memory Management Issue Pin
Dangleberry11-Sep-03 0:14
sussDangleberry11-Sep-03 0:14 
GeneralRe: Horrid Memory Management Issue Pin
antlers11-Sep-03 9:39
antlers11-Sep-03 9:39 
GeneralRe: Horrid Memory Management Issue Pin
Dangleberry11-Sep-03 23:15
sussDangleberry11-Sep-03 23:15 
GeneralProblem handling pictures Pin
abhi197110-Sep-03 22:19
abhi197110-Sep-03 22:19 
GeneralRe: Problem handling pictures Pin
Dangleberry10-Sep-03 22:37
sussDangleberry10-Sep-03 22:37 
GeneralRe: Problem handling pictures Pin
abhi197110-Sep-03 22:51
abhi197110-Sep-03 22:51 
GeneralRe: Problem handling pictures Pin
Dangleberry10-Sep-03 22:58
sussDangleberry10-Sep-03 22:58 
GeneralRe: Problem handling pictures Pin
abhi197110-Sep-03 23:02
abhi197110-Sep-03 23:02 
GeneralRe: Problem handling pictures Pin
Dangleberry10-Sep-03 23:41
sussDangleberry10-Sep-03 23:41 
GeneralRe: Problem handling pictures Pin
Jagadeesh VN11-Sep-03 4:51
Jagadeesh VN11-Sep-03 4:51 
GeneralRe: Problem handling pictures Pin
abhi197111-Sep-03 22:36
abhi197111-Sep-03 22:36 
GeneralSocket programming in Visual C++ 6 Pin
fahimtufaillara10-Sep-03 21:55
fahimtufaillara10-Sep-03 21:55 

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.