Click here to Skip to main content
15,887,135 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how big array size does a visual c++ program allow ? Pin
Maximilien24-Apr-06 10:02
Maximilien24-Apr-06 10:02 
GeneralRe: how big array size does a visual c++ program allow ? Pin
mrby12324-Apr-06 10:07
mrby12324-Apr-06 10:07 
Answer[Message Deleted] Pin
Joe Woodbury24-Apr-06 10:08
professionalJoe Woodbury24-Apr-06 10:08 
GeneralRe: how big array size does a visual c++ program allow ? Pin
venadder24-Apr-06 10:10
venadder24-Apr-06 10:10 
GeneralRe: how big array size does a visual c++ program allow ? Pin
mrby12324-Apr-06 10:11
mrby12324-Apr-06 10:11 
GeneralRe: how big array size does a visual c++ program allow ? Pin
David Crow24-Apr-06 10:19
David Crow24-Apr-06 10:19 
GeneralRe: how big array size does a visual c++ program allow ? Pin
Rilhas25-Apr-06 9:22
Rilhas25-Apr-06 9:22 
AnswerRe: how big array size does a visual c++ program allow ? Pin
Stephen Hewitt24-Apr-06 21:54
Stephen Hewitt24-Apr-06 21:54 
Using new and delete [] or GlobalAlloc will work but it is operating at an unnecessarily low level. Standard C++ has a container called a vector which will suit your needs and has many advantages including the fact that it automatically frees memory saving you from the burden of remembering to call delete [].

To use it first include its header file like this:
#include <vector>


Now you can whip up a vector of floats like this:
std::vector<float> YourVectorOfFloats


Now you can use this as before but you don't need to call delete [] and it has lots of member functions that you can use.

For example, you want to expand it? No worries:
YourVectorOfFloats.resize(400);


Unless he has highly specialized needs there is no good reason for a C++ programmer to use new and delete [] or Win32 APIs such as GlobalAlloc to make dynamic arrays - In general it is a mistake to do so.

Steve
GeneralRe: how big array size does a visual c++ program allow ? Pin
mrby12325-Apr-06 16:03
mrby12325-Apr-06 16:03 
QuestionSuggestions for Memory Leak Tool Pin
Barry Etter24-Apr-06 7:10
Barry Etter24-Apr-06 7:10 
AnswerRe: Suggestions for Memory Leak Tool Pin
Maximilien24-Apr-06 7:49
Maximilien24-Apr-06 7:49 
AnswerRe: Suggestions for Memory Leak Tool Pin
Shog924-Apr-06 8:00
sitebuilderShog924-Apr-06 8:00 
AnswerRe: Suggestions for Memory Leak Tool Pin
Joe Woodbury24-Apr-06 10:20
professionalJoe Woodbury24-Apr-06 10:20 
QuestionHow to get my IP ? Pin
Surivevoli24-Apr-06 7:02
Surivevoli24-Apr-06 7:02 
AnswerRe: How to get my IP ? Pin
Bob X24-Apr-06 7:11
Bob X24-Apr-06 7:11 
GeneralRe: How to get my IP ? Pin
Surivevoli24-Apr-06 8:13
Surivevoli24-Apr-06 8:13 
GeneralRe: How to get my IP ? Pin
Bob X24-Apr-06 10:24
Bob X24-Apr-06 10:24 
GeneralRe: How to get my IP ? Pin
Nibu babu thomas24-Apr-06 17:09
Nibu babu thomas24-Apr-06 17:09 
AnswerRe: How to get my IP ? Pin
David Crow24-Apr-06 7:36
David Crow24-Apr-06 7:36 
QuestionSelection of lengthy path in the open save dialog box, retunr truncated string Pin
Sandeep. Vaidya24-Apr-06 5:37
Sandeep. Vaidya24-Apr-06 5:37 
AnswerRe: Selection of lengthy path in the open save dialog box, retunr truncated string Pin
Nibu babu thomas24-Apr-06 17:17
Nibu babu thomas24-Apr-06 17:17 
GeneralRe: Selection of lengthy path in the open save dialog box, retunr truncated string Pin
Sandeep. Vaidya24-Apr-06 20:25
Sandeep. Vaidya24-Apr-06 20:25 
GeneralRe: Selection of lengthy path in the open save dialog box, retunr truncated string Pin
Sandeep. Vaidya25-Apr-06 0:06
Sandeep. Vaidya25-Apr-06 0:06 
GeneralRe: Selection of lengthy path in the open save dialog box, retunr truncated string Pin
Nibu babu thomas25-Apr-06 1:49
Nibu babu thomas25-Apr-06 1:49 
Questionoverride operator + Pin
ehh24-Apr-06 5:06
ehh24-Apr-06 5:06 

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.