Documentation Project 1
ContentsIndexHome
PreviousUpNext
sack::memory::New Macro
C++
#define New(type) ((type*)Allocate(sizeof(type)))
Parameters 
Description 
type 
type to allocate 

A simple macro to allocate a new single unit of a structure. Adds a typecast automatically to be (type*) so C++ compilation is clean. Does not burden the user with extra typecasts. This, being in definition use means that all other things that are typecast are potentially error prone. Memory is considered uninitialized.

int *p_int = New( int );
Copyright (c) 2010. All rights reserved.
What do you think about this topic? Send feedback!