Access underrun

From Appmethod Topics
Jump to: navigation, search

Go Up to Access Errors

The Access Underrun error is similar in semantics with the Access Overrun error, except that the invalid memory access occurs before the region of memory, not after it.

#include <tchar.h>
#pragma hdrstop
class someclass{
	int fnumber;
	int getnumber(){return fnumber;}
	void setnumber(int nw){fnumber = nw;}
	int doublev(int val){return val*2;}
	int publicalval;


void myf()
  someclass *myc = new someclass[2];
  int answ;
  answ = myc[-1].publicalval = 10; // error
  delete[] myc;


int _tmain(int argc, _TCHAR* argv[])
	return 0;