Dec.19.2018 -- CAlive to introduce ~~ shorthand pointers

13 views
Skip to first unread message

Rick C. Hodgin

unread,
Dec 19, 2018, 9:22:44 PM12/19/18
to caliveprogra...@googlegroups.com
CAlive will introduce the ability to access a uniquely named child member using the ~~> shorthand pointer, rather than the -> standard pointer.  When ~~> is used, it will traverse the child classes or structures to find the uniquely named member, referencing it without explicitly naming the intermediate child members.  The ~~> shorthand pointer will work where -> or . would normally be used.  It is a common syntax for both.

    // Define a structure
    struct SGrandChild
    {
        s32  gcInt;
    };

    struct SChild
    {
        SGrandChild  gc;
    };

    struct SExample
    {
        SChild* child;
    };

    // Use in code:
    SExample* e = generate_new_e();

    e->child->gc.gcInt = 5;    // Traditional access
    e~~>gcInt          = 5;    // New CAlive ~~> access

In this way, the construction is read as "the gcInt member of e's progeny, being distinct and unique in its name."

-- 
Rick C. Hodgin

Reply all
Reply to author
Forward
0 new messages