1. 24
    1. 4

      Looking great so far. The proposal I’m rooting for, N2592 #embed doesn’t seem to have made it in yet. Luckily, still a couple meetings to go.

      .・゚゚・(/ω\)・゚゚・. My cross-plattform toolchains may stay unreadable Makefile messes for a decade longer.

      1. 3

        you mean to say that xxd -i as part of your makefiles is .. “suboptimal”? :) I am hoping for n2936 - A simple defer feature myself and barring anything said on the meeting notes for this one, it seems to be on the table still.

        1. 4

          unfortunately:

          defer, Lambdas, and similar were voted down, but still have consensus to proceed for a timeline beyond/after C23

          1. 12

            Lambdas are tricky:

            • If you want to pass them as function arguments then you need to be able to write a type for them.
            • If you can write a type for them, you can store them on the heap.
            • If you can store them on the heap, you need to ensure that they can own pointers and deallocate the underlying object (or drop a reference count) on destruction.

            C++ can support lambdas because it has templates that take generic types and so lambdas can be opaque types that are wrapped in a type-erased template if you want to capture them and because it has destructors that can be used (with templates) to create smart pointers to manage captured resources.

            Objective-C can support lambdas because it has reference counting semantics (including weak references) baked into the language and so can use these for lifetime management of captured objects and because all objects are allocated on the heap (logically, there’s some fun lazy allocation for blocks) and so they can be type-erased as pointers with a function-like type signature.

            Java, C#, JavaScript, and so on can support lambdas because they have dynamic dispatch (and so the lambdas can be opaque types that implement a call-as-function-with-this-signature method) and they have garbage collection (and so lifetimes for captured objects are handled the same way as everything else).

            It’s very hard for me to see how you can have lambdas in a language that doesn’t have either automatic memory management or generics, without baking a lot of complexity into the language that’s special-cased for lambdas. You could do it by adding auto types, destructors on structs, and generics to C, at which point lambdas are just syntactic sugar. But at that point you may as well just use C++.

      2. 3

        I’m planning to give this a more thorough read over the weekend but I gotta say, y’all are all happy about defers and lambdas and presumably a special templating system with jetpacks and lasers shooting out of its generics but I’m just happy N2888 - Require Exact-width Integer Type Interfaces, Part II is in. Other documents already simplified the integer model in a bunch of useful ways, and this will hopefully rid us of some of the obscurity involved in wider types.