Size of dynamically allocated array

What's the easiest way to determine the size (number of objects) of a
dynamically allocated array?


9/26/2003 4:04:57 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 29

While it's probably not reliable, I did find that the address you get back
from the 'new' operator is not the actual starting address of the allocated
block.  If you subtract sizeof(DWORD)*4 from that address and then read the
value at that address, you'll have the requested size, but not the actual
size that the memory manager allocated.  For example:

char *p = new char[1234];
strcpy(p, "Hello World!"); // not necessary but does help to locate stuff in
char *a = p - (sizeof(DWORD) * 4);
DWORD dwVal = *a; // should be 1234

In this example, the actual size of the block was 1304 bytes.

"Chip Pulitzer" <> wrote in message
> What's the easiest way to determine the size (number of objects) of a
> dynamically allocated array?
> Chip

david.crow (132)
9/26/2003 8:21:58 PM

Similar Artilces:

default font size for comments
Is there a way to change the default font size for comments inserted into an Excel worksheet? It defaults to Tahoma 8 pt, which is too small, and is not the font I want to use. Windows>start>settings>control panel>display or right click desktop>properties then appearance and advanced (in XP), scroll find tooltips. That is where it can be changed Obviously it will affect more than comments -- Regards, Peo Sjoblom "dan yntema" <> wrote in message news:5b0301c40095$2d750f70$a001280a@phx.gbl... > Is there a way to chan...

IE8 text size 01-25-10
The situation described occurs in IE8 on both Vista home premium and Windows 7 professional. Using the page options, I set the text size to smaller. It will remain that way for a while but within hours or sometimes a day the text size reverts to medium. Any suggestions Lou ...

Mailbox Size limit
A user is receiving the warning email "Your mailbox is over its size limit", saying his email mailbox size is 1,100,000 KB and the limit before the warnings is 1,000,000 KB (numbers used for this example). The problem is, yesterday he deleted the emails out of his mailbox that brough him down to 950,000 KB, and today he's deleted his mailbox down to 750,000 KB. I guess we'll see if he gets another warning email, but really he shouldn't have received one this morning. Any thuoghts as to why? He did log off his computer yesterday so I would have thought that the mailbox ...

Array formula #2
Hi, I have a list of numbers and I want the average not counting the 0.00 in the range. a 12 15 19 0 101 150 0 52 67 122 Now my formula is {=average(if($a$1:$a$10<>0,$a$1:$a$10,0))} This will sum to 538 and average to 53.8 The result I am looking for is sum 538/8 or 67.25 Where is my error?? TIA ray Ray, Leave off that last ",0": array enter (using Ctrl-Shift-Enter) =AVERAGE(IF(A1:A10<>0,A1:A10)) HTH, Bernie MS Excel MVP "Ray" <> wrote in message news:1757401c448bf$32508e30$a101280a@phx.gbl... > Hi, > I have ...

Excel file size increased 3 times after saving!!!!
Hi all, I have a very strange situation with my Excel workbook. I created Excel workbook with conditional formulas (no other formulas) which total size is 3 Mb. After I put simple data for calculation and saved the workbook the size increased to 10Mb! The data itself is just about 70Kb. I use Excel 2002 at work. I should put this workbook on our company server, but our network is not very good and people can't open it because of the 10MB. I have never seen this before! Can somebody help please? Thank you in advance! I don't claim to be an expert on Excel by any...

Problem to modify the size of PlotArea
Hello, I am trying to modify a chart so that it prints in a 20cm x 17,5cm frame. I do understand that this is governed by the plotarea.insideheight and plotarea.insidewidth properties. I also do understant that these properties are read-only. So far my code is the following: With ActiveChart .SizeWithWindow = False .PageSetup.ChartSize = xlScreenSize .PlotArea.Width = 567 .PlotArea.Height = 496 Do While .PlotArea.InsideWidth < 567 .PlotArea.Width = .Pl...

Rank Query With Groups (Array?)
Hello, I have a table of data with grades which are grouped by study. I need to rank the grades relative to all the other grades in the same study. Below is an example the study and grade fields with the desired outcome for the rank. Study Grade Rank 11111 89 1 11111 75 2 11111 65 3 22222 99 1 22222 87 2 Hopefully this can be done with simple SQL in a query and not with code but I am open to anything that works. Many thanks in advance for your time and expertise! Try this -- SELECT Study, Grade, (SELECT Count(*) FROM YourTable AS [XX] WHERE You...

Dynamics Great Plains v10 trial version
I just recently downloaded (from the MS website) the 90-day trial version of GP v10 to my personal computer. The install appeared to go well however, while the login is "SA" I do not know the password. I have tried "password" and tried leaving it blank. Anyone know the answer? When I called MS Business Solutions, they told me that it will ask me to set up a password during the install, it did not. Thank you Did you try 'sa' as the password? -- Bud Cool, Accounting System Manager HDA, Inc. Hazelwood, MO GP 9.0, SP2 "Pam" wrote: > I just...

Sales Tax Issue with Dynamics RMS
Here in California, the sales tax recently increase from 8.25% to 9.25%. I made this appropriate changes to the sales tax settings in RMS. The issue is when I get a return for items purchased prior to the sales tax change, the customer is credited at the current sales tax rate of 9.25% rather than the 8.25% that they should be credited. I need to be able to adjust the sales tax percentage at the POS for these returns so that the sales tax amount is correct. Any suggestions? Paul: How about setting up an "Old Tax" code at 8.25% and using Shift-F12 to select and apply the old tax...

I retrieve a PivotTable in Analysis Services. How can i get the Pivotitems in spreadsheet to hide/unhide? I maked a loop in the pivottable, but the interop disable th pivotitems -- zeri ----------------------------------------------------------------------- zeric's Profile: View this thread: ...

Check Box Sizing
Hi, When using check boxes, no matter how much I resize the area, the actual check box itself never gets larger (only the area for a description does). Is there any way to increase the size of the check box so that a larger check mark appears on the worksheet? Thanks, Brad. Brad, If you select "move and size with cell" (on the properties tab) then you can resize the checkbox by increasing the column width and/or row height. Give my regards to Boston. HTH, Bernie MS Excel MVP "beantownbrad" <> wrote in message news:C63B5725-...

How to export mailbox size list from exchange server 5.0?
Does anybody can help me to find a way to export exchange mailbox size list? my exchange server is 5.0vs. THank you very much. J In EXadmin, navigate to the mailbox list under the server - there is a column listing the mailbox sizes. Export that out. HTH. "yiyuhong" <> wrote in message news:OrEsz8s6DHA.2748@TK2MSFTNGP09.phx.gbl... > Does anybody can help me to find a way to export exchange mailbox size list? > my exchange server is 5.0vs. THank you very much. > > J > > ...

dynamic menu
Does anybody have any sample on how to build menu dinamically using xml files? Dan has some on his site. This one is useful. Thanks. Mark PM - System.Xml -- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at "cribeiro" <> wrote in message news:OclagBccDHA.652@tk2msftngp13.phx.gbl... > Does anybody have...

Tasks doble it's size
Hi! Does anyone know why the size of one of my tasks dobles when I just change one word e.g.? I dobles like this: from 200 kb to 400 kb to 800 kb and so forth. No the size of it is 12 mb and it contains only text (HTML-format). Now that it's that big I have to delete something in it to make a new note to it. How can I resolve this problem? I'm using Outlook 2003 (Office2003 and WinXP). Thanks in advanced! Tina :-) ...

Limit Attachment size
Hello We are using Outlook 2007 with POP3 mail accounts , No Exchange Server Is there a way when a user press Send to run a VBA code to check if any attachment in the mail is exceeding certain size limit we specify, say 5 Mega Max. , if so it displayes an error to user and refuse to send the mail Any help is very appreciated Thanks Bassam > We are using Outlook 2007 with POP3 mail accounts , No Exchange Server > > Is there a way when a user press Send to run a VBA code to check if > any attachment in the mail is exceeding certain size limit we specify, > say 5 Mega Max....

Inserting arrays as variables
How can I insert an array or range of variables (e.g. .042 to .168) into a formula? Alternatively, can I define variables (e.g. x, y) without having to use Visual Basic? I'm trying to create a chart which outputs values based on constants and a function involving the range of variables. Thanks for your help! {0.042,0.07,0.1,0.11,0.123,0.13,0.168} as an example -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "anthonyd" <> wrote in message news:404CE381-5890-458B-9A43-6EA3CB894591@micros...

countif, but only using partial cell contents in the reference array #5
thanks for your help max - indeed there are blank cells in the range. the work around will do, but as always, i like stuff to be clean - les chance of screwing things up again, much thanks, jare -- jared ----------------------------------------------------------------------- jaredh's Profile: View this thread: You're welcome ! Thanks for the feedback Track your post awhile for possible insights from others .. -- Rgds Max xl 97 --- Please respond in thread x...

Creating array from matrix with blank values
I have a matrix in the following format 1 X X X X X X X X X X X 3 X X X X X 4 X X X X X X X X where 'X' is a blank cell. I need to get the data in the form 1 3 4 Any suggestions? I tried a nested if statement but it doesn't work since there are more than 7 ifs. Andryll, If there is only one value in each row, then simply using =SUM(A1:L1) where A1:L1 is your top row, then copied down for two more rows, will give you your desired result. HTH, Bernie MS Excel MVP <> wrote in message

array function
I'm having trouble making an array. When do you press ctrl-alt-enter -- cutsygur ----------------------------------------------------------------------- cutsygurl's Profile: View this thread: when you edit the formula, you normally exit edit mode by selecting another cell or hitting Enter. At this point, you should hit Ctrl+SHIFT+enter instead. (SHIFT, not ALT) -- Regards, Tom Ogilvy "cutsygurl" <cutsygurl.1rhxmf_1120230340.4504@excelforum-...

Mail rejected due to size even though it was a very small message
Greetings, I had a message rejected by my E2K3 SP2 server with this error message: This message is larger than the current system limit or the recipient's mailbox is full. Create a shorter message body or remove attachments and try sending it again. <xxxxxx.xxxx.local #5.2.3> The message was very short and had a pdf attachment that was only 197k. After a few resends, it made it through. I have no message size restrictions and no mailbox quota verified by Q322679. This is the only message this happened to, so I am unable to reproduce the problem. I don't lik...

Availability of MS Dynamics POS trial version
I tried to find the trial version last week and it appears that it is no longer available. Anybody know what is up or any alternatives? Right now it appears my only option is to buy one seat to do the evaluation. Thanks, This is a multi-part message in MIME format. ------=_NextPart_000_06BE_01C7AED3.C3690280 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: quoted-printable Matt, Did you try here? = Click on the link and fill out the form Or try a reseller that sells MSPOS for one. --=20 Jeff=20 C...

Child windows that keep same relative size
/* I am trying to make a window with a bunch of child windows that resize themselves so that they always take up the same proportion of the client window...sort of like something that java does?? I have one button in my window, and it behaves ok, but before I start adding a bunch of other child windows, could you kind folks please look at my code and give me some software design guidance so I minimize code duplication. ....any hints good!! thanks */ // Main.cpp #include "CMyWinApp.h" CMyWinApp MyApplication; // CMyWinApp.h #include <afxwin.h> class CMyWinApp : public CWi...

allocating numbers to cells
The numbers represent rounds. So a name will go with a round (number) but some names know more than one round. Name a 1 name b 2 name c 3 name d knows round 1 and 2 name e knows round 2 and 3 Is there an automatic function that would allocate "name d" or "name e" to a round if "name a, b or c" were not available for that day? The table would look like this Name a 1 name b 2 name c 3 name d name e Say for example "name a" was not available how would "name d" get allocated to r...

pst file size #4
I have just archived the bulk of my bloated (3gb) pst file but was surprised to see that although an archive file has been created (2.8gb), the size of the original pst file has not changed, despite the fact that old emails are not longer visible. My reason for archiving was to try to get the pst file down to a manageable size as it seems to be slowing the operation of my Outlook 2007 program. What have I done wrong? Thanks in advance. When you archive mail, it goes into a separate PST file (usually called archive.pst). Is this the PST file you're talking about? -- Kathleen Orl...

how do you change the print merge batch size from 10 records?
How can I change the default output of 10 printed records to say 500? Chris Bartlett <> was very recently heard to utter: > How can I change the default output of 10 printed records to say 500?;en-us;891904 has details of how to change the batch size to 1 for stapling/collating purposes. If you follow the instructions, but use a value of 500 instead of 1, then you will get 500 records per batch. -- Ed Bennett - MVP Microsoft Publisher ...