Jul.19.2018 -- CAlive to add relative name placeholders

7 views
Skip to first unread message

Rick C. Hodgin

unread,
Jul 19, 2018, 3:46:08 PM7/19/18
to CAlive Programming Language
CAlive will allow the prior or next thing referenced using the -$ and +$ syntax.  These can be used as references to obtain the size, or a pointer to the referenced thing, depending on context.

    struct SPairs
    {
        s8*   text;
        u32   length;
    };

    SPairs pairs[] =
    {
        { "first",   sizeof(-$) },
        { "second",  sizeof(-$) },
        { "third",   sizeof(-$) },
        { "fourt",   sizeof(-$) },
    };

    printf("The string is %d bytes, and is: %s", sizeof(+$), "Hello mom!");

-- 
Rick C. Hodgin

Reply all
Reply to author
Forward
0 new messages