Click here to Skip to main content
15,896,606 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: calling int 21h from a __asm block of code Pin
David Crow8-Aug-05 8:42
David Crow8-Aug-05 8:42 
GeneralRe: calling int 21h from a __asm block of code Pin
Gary R. Wheeler8-Aug-05 12:56
Gary R. Wheeler8-Aug-05 12:56 
GeneralFailing Debug Assertion in DoModal() Pin
gremlinimp6-Aug-05 19:20
gremlinimp6-Aug-05 19:20 
GeneralRe: Failing Debug Assertion in DoModal() Pin
Jose Lamas Rios6-Aug-05 20:23
Jose Lamas Rios6-Aug-05 20:23 
GeneralRe: Failing Debug Assertion in DoModal() Pin
gremlinimp6-Aug-05 20:47
gremlinimp6-Aug-05 20:47 
GeneralRe: Failing Debug Assertion in DoModal() Pin
gremlinimp6-Aug-05 20:49
gremlinimp6-Aug-05 20:49 
GeneralLarge Array Implementing Pin
Majid Shahabfar6-Aug-05 19:07
Majid Shahabfar6-Aug-05 19:07 
GeneralRe: Large Array Implementing Pin
John R. Shaw6-Aug-05 22:09
John R. Shaw6-Aug-05 22:09 
SHORT ANSWER:
Use the standard template vector<> (#include <vector>).

If you know the (aproximate) number of elements needed for storage, before coping, then call the member function reserve(), in order to reduce the number of reallocations required when adding new elements to the array.

LONG ANSWER:
The best solution depends on how it is going to be used (implimentation dependent). If you need a dynamic array (increases/decreases size as needed) then use the vector<> template (which is a one dimensional dynamic array). The maximum size of an array of elements, depends on the size of the elements and amount of memory available.

If you use a vector, you can call the max_size() member to determine what is, theoretically, the maximum number of elements that can be stored in a vector. I say theorectically because it, again, depends on the size of the element being stored, the amount of available memory and the amount of contiguous memory that can be allocated (on a given system).

THAT'S ENOUGH:
In C++ just use vector<>, unless you have a good reason not to.

NOTES:
1) Never use type* pArray = new type[size] when type Array[size] will solve the problem.
2) Prefer:
vector<type> myarray;
myarray.reserve(size);
TO
type* pArray = new type[size];

Good Luck!

INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
GeneralClistControl giving exceptions Pin
Aditya Rao6-Aug-05 17:38
Aditya Rao6-Aug-05 17:38 
GeneralRe: ClistControl giving exceptions Pin
Tim Smith6-Aug-05 18:07
Tim Smith6-Aug-05 18:07 
QuestionMultislider control? Pin
Ravi Bhavnani6-Aug-05 14:00
professionalRavi Bhavnani6-Aug-05 14:00 
AnswerFound it! Pin
Ravi Bhavnani6-Aug-05 14:39
professionalRavi Bhavnani6-Aug-05 14:39 
GeneralRe: Found it! Pin
Steve Mayfield6-Aug-05 18:26
Steve Mayfield6-Aug-05 18:26 
GeneralRe: Found it! Pin
Ravi Bhavnani6-Aug-05 18:29
professionalRavi Bhavnani6-Aug-05 18:29 
GeneralRe: Found it! Pin
Trollslayer6-Aug-05 23:25
mentorTrollslayer6-Aug-05 23:25 
GeneralOdd MessageBox Problem Pin
sir kaber6-Aug-05 13:43
sir kaber6-Aug-05 13:43 
GeneralRe: Odd MessageBox Problem Pin
sir kaber6-Aug-05 13:49
sir kaber6-Aug-05 13:49 
GeneralRe: Odd MessageBox Problem Pin
John R. Shaw7-Aug-05 0:22
John R. Shaw7-Aug-05 0:22 
GeneralRe: Odd MessageBox Problem Pin
sir kaber7-Aug-05 9:00
sir kaber7-Aug-05 9:00 
GeneralDialog problems with VC6.0 built under XP Pin
Haakon S.6-Aug-05 12:36
Haakon S.6-Aug-05 12:36 
GeneralRe: Dialog problems with VC6.0 built under XP Pin
John R. Shaw7-Aug-05 1:26
John R. Shaw7-Aug-05 1:26 
GeneralRe: Dialog problems with VC6.0 built under XP Pin
Haakon S.7-Aug-05 3:36
Haakon S.7-Aug-05 3:36 
GeneralRe: Dialog problems with VC6.0 built under XP Pin
Gary R. Wheeler7-Aug-05 3:32
Gary R. Wheeler7-Aug-05 3:32 
QuestionMAPI: How to read PR_MANAGER_NAME? Pin
Mark Findlay6-Aug-05 11:44
Mark Findlay6-Aug-05 11:44 
AnswerRe: MAPI: How to read PR_MANAGER_NAME? Pin
Jose Lamas Rios6-Aug-05 14:44
Jose Lamas Rios6-Aug-05 14:44 

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.