Login
You're viewing the discuss.systems public feed.
  • May 10, 2026, 9:46 AM
    retooted Thalia Archibald

    A cursed feature of C in 1972: Labels and functions were reassignable (i.e., lvalues)!

    For example, this is a clever way to initialize once:

    goto init;
    init:
    ouptr = oubuf;
    init = init1;
    init1:

    which is compiled to:

    jmp *4120
    mov 4136,4144
    mov 4122,4120

    Note the indirect jump and assignment to that address. All gotos used indirect jumps. This apparently would have also worked with functions.

    💬 11🔄 76⭐ 158