Home > Back-end >  I'm trying to study "the C programming art" this book, the second chapter of the garb
I'm trying to study "the C programming art" this book, the second chapter of the garb

Time:10-22

I am in learning c + + programming "art" this book, the second chapter of the garbage collector, how to run code not up?
Run under VC6.0 error pop up box that memory cross-border problems, under Linux directly is not compiled through, program is to recycle crossing the line of memory, to overcome

CodePudding user response:

The code posted and have a look

CodePudding user response:

Code to hundreds of line,,,, how can I let you see?

CodePudding user response:

http://user.qzone.qq.com/359324687/infocenter#! App=2 & amp; Via=QZ. HashRefresh& Pos=1368151689
Gc. H point connect can see, below is the show. The CPP

Show the CPP
#include
#include
# include "gc. H"
using namespace std;
Int main () {
GCPtr p;
GCPtr q;
Try {
P=new int (10);
Q=new int (11);
cout <"Value at p is:" & lt; <* p & lt; cout <"Value at q is:" & lt; <* q & lt; cout <"Before the if block. \ n";
//Now, create a local object.
{//start a block
GCPtr R=new int (12);
cout <"Value at r is:" & lt; <* r & lt; }//end of the block, causing r to go out of scope
cout <"After exiting block. \ n";
{} the catch (bad_alloc exc)
cout <"Allocation failure! \n";
return 1;
}
}

CodePudding user response:

What is the original book in programming environment to run?

CodePudding user response:

Didn't write,,,

CodePudding user response:

I was also looking at the book, it's really something wrong with the code of the book, I changed, as if can run,

CodePudding user response:

Should be a garbage collect () the function to write has a problem, yourself to gclist. The debugged, remove (* p) there seems to be a problem on this,
  • Related