News for hackers. Stuff that matters.
Re:C's designated initializers give us named arguments by robinsonb5 on Thursday November 19, 2026 @09:53AM (#50560919)
Yes indeed. I've often wondered where it came from - did they invent it, or was it inspired by something on another platform?

(For the uninitiated, taglists are freeform lists of TAG / value pairs, which you would typically supply through varargs functions - something like OpenScreenTags(&newscreenstruct,SA_WIDTH,320,SA_HEIGHT,256,SA_DISPLAYID,myscreenmode,TAG_DONE); )

Re:C's designated initializers give us named arguments by flohofwoe on Thursday November 19, 2026 @10:04AM (#50561055)
IMHO the main problems with this idea is that it isn't type-safe and it's wasting a lot of stack space for the tags.

> I've often wondered where it came from

Don't know but the other place where I've seen this idea is when initializing OpenGL contexts on some platforms. This involves defining attribute key/value pairs like this:

    int attributes[] =
    {
        GLX_RED_SIZE, 8,
        GLX_GREEN_SIZE, 8,
        GLX_BLUE_SIZE, 8,
        GLX_ALPHA_SIZE, 8,

        GLX_DEPTH_SIZE, 24,
        GLX_STENCIL_SIZE, 8,

        GLX_DOUBLEBUFFER, True,

        None
    };
Of course OpenGL is a bit later than AmigaOS, but not by much :)
Re:C's designated initializers give us named arguments by kevin_thibedeau on Thursday November 19, 2026 @11:32AM (#50562283)
XView worked similarly. It had a small handful of variadic functions for its API that you passed lists of arguments into.