For Programmers: Free Programming Magazines  


Home > Archive > VC Language > January 2006 > Re: Overloading new









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Overloading new
maynard

2006-01-24, 7:07 pm


Igor Tandetnik wrote:
>
> Second, the pointer returned by new[] expression may not point to the
> beginning of the allocated memory, and usually doesn't. Again, the
> compiler usually requests more memory than would be occupied by the
> elements themselves. It stores certain housekeeping information (at
> least, the number of the elements allocated) at the beginning of the
> block, and returns a pointer that points right after this internal data.


Ah, so the behavior is compiler specific? I must pay better attention
to the examples I find on websites :-)

>
> Bottom line: the only thing operator new can do is allocate raw memory.
> There's no point writing anything into this memory (except perhaps
> filling it with a distinct bit pattern for debugging purposes) - it will
> essentially be wiped out and repaved when constructors are run.


Now I understand. Thanks for your help Igor.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com