array allocaton size
From: Keith S. (false_at_ntlworld.com)
Date: 06/25/04
- Next message: Karl Heinz Buchegger: "Re: Read-only, as opposed to const member"
- Previous message: Karl Heinz Buchegger: "Re: Confused by the constructor and cop-constructor."
- Next in thread: Karl Heinz Buchegger: "Re: array allocaton size"
- Reply: Karl Heinz Buchegger: "Re: array allocaton size"
- Reply: SaltPeter: "Re: array allocaton size"
- Reply: Victor Bazarov: "Re: array allocaton size"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Jun 2004 11:17:51 +0100
This may be a dumb question, but I've searched the FAQ
and can't find an obvious answer...
Let's say I have a class e.g.
class fred
{
public:
int x;
int y;
};
then I create an array of fred:
freds = new fred[2];
Now, I'd expect to have allocated 8 bytes * 2 i.e. 16 bytes.
However, if I step through the code with a debugger I see
that operator new is getting called with a size of 20 bytes.
Why is this? What's the extra 4 bytes coming from?
The platform is VC++ .NET 2003 in debug mode if it makes any
difference...
- Keith
- Next message: Karl Heinz Buchegger: "Re: Read-only, as opposed to const member"
- Previous message: Karl Heinz Buchegger: "Re: Confused by the constructor and cop-constructor."
- Next in thread: Karl Heinz Buchegger: "Re: array allocaton size"
- Reply: Karl Heinz Buchegger: "Re: array allocaton size"
- Reply: SaltPeter: "Re: array allocaton size"
- Reply: Victor Bazarov: "Re: array allocaton size"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|