MAF example

#include <iostream.h>

#include <windows.h>

 

#define VERY_LARGE 0x7fffffff       //More RAM than we can get

int

main(int, char **)

{

    char *ptr = new char[VERY_LARGE];   //MAF: can't get this much

    if (ptr == 0) {

        cerr << "Failed to alloc, as expected\n";

        return (1);

    } else {

        cerr << "Got " << VERY_LARGE << " bytes @" << (unsigned long)ptr << '\n';

        delete[] ptr;

        return(0);    

    }

}

(C) Copyright IBM Corporation 1992, 2010.