NEW

Table of Contents

NEW

Description

Allocates zero-initialized memory for a type.

Parameters

NameDirectionDescription
tnameinType name to allocate memory for.

Success

Returns pointer to zero-initialized memory block.

Failure

Returns NULL if memory allocation fails.

Usage example (Cross-references)

    
    SysMutex *SysMutexCreate(void) {
    SysMutex *m = NEW(SysMutex);
    #ifdef _WIN32
    InitializeCriticalSection(&m->lock);
    close(stderr_pipe[WRITE_END]);
    
    SysProc *proc   = NEW(SysProc);
    proc->pid       = pid;
    proc->stdin_fd  = stdin_pipe[WRITE_END];
    CloseHandle(hStderrWrite); // parent won't write to child's stderr, will read from it
    
    SysProc *proc     = NEW(SysProc);
    proc->pi          = pi;
    proc->hStdinWrite = hStdinWrite;

Share :

Related Posts

ALIGN_DOWN_POW2

ALIGN_DOWN_POW2 Description Aligns the given value down to the nearest power-of-two multiple.

Read More

ALIGN_UP_POW2

ALIGN_UP_POW2 Description Aligns the given value up to the nearest power-of-two multiple.

Read More

LVAL

LVAL Description Creates a temporary, addressable l-value from a given expression x.

Read More