Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATA MEMBERS Size

Status
Not open for further replies.

Robertus

Programmer
Feb 16, 2001
81
0
0
RO
I have a class with a data member of 128 KB (a character string)

class cmyclass
{
protected:
char buff[131072];
public:
//constructor
cmyclass(const char* pChar)
{
memset(buff,0,131072*sizeof(char));
strcpy(buff,pChar);
}
//destructor
}

the program crashes at runtime (I do not use malloc or new) in the RELEASE version; do you know why??

Isn't it possible to have members with bigger size than 64 KB ???

void main(void)
{
.....
cmyclass obj("John");
....
}
 
OK, I assume the same thing, but WHY?
Why am I not allowed to have data members with a bigger size than 64K ???
(in debug mode it works, but in release it crashes)
 
had a similar problem but with buff[128].
what I did was char buff[128] = "".
Try it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top