Documentation Project 1
sack::containers::list::AddLink Macro
#define AddLink(p,v) ( AddLinkEx( (p),((POINTER)(v)) DBG_SRC ) )

Adds a pointer to a user object to a list.

// the list can be initialized to NULL,
// it does not have to be assigned the result of a CreateList().
// this allows the list to only be allocated if it is used.
PLIST list = NULL;
AddLink( &list, (POINTER)user_pointer );
    POINTER p; // this should be USER_DATA_TYPE *p;
    INDEX idx; // just a generic counter.
    LIST_FORALL( list, idx, POINTER, p )
        // for each item in the list, p will be not null.
        if( p->something == some_other_thing )
    // p will be NULL if the list is empty
    // p will be NULL if the LIST_FORALL loop completes to termination.
    // p will be not NULL if the LIST_FORALL loop executed a 'break;'
Copyright (c) 2010. All rights reserved.
What do you think about this topic? Send feedback!