• C implementation headers [was Re: "A diagram of C23 basic types"]

    From Scott Lurndal@21:1/5 to David Brown on Thu Apr 10 15:17:53 2025
    David Brown <david.brown@hesbynett.no> writes:
    On 10/04/2025 16:29, bart wrote:

    <big snip>


    Huh? Do you really want to go down that path of analysing exactly what
    gcc is and isn't? 'gcc' must be the most famous C compiler on the planet!


    Everyone else already knows gcc is a compiler. It certainly does not
    have a "windows.h" header. It is that simple.

    Yes we all know that 'gcc' /now/ stands for 'gnu compiler collection' or
    something, and that it is a driver program for a number of utilities.
    But this is a C group which has informally mentioned 'gcc' for decades
    across tens of thousands of posts, but you had to bring it up now?

    Any viable C compiler that targets Windows, gcc included, needs to
    provide windows.h.

    A C /implementation/ targeting Windows is likely to have some >Windows-specific headers packaged with it.

    <snip>


    Yes, and we know what such code looks like, with long chains of
    mysterious arguments, many of which are zeros or NULLS:

        hwnd = CreateWindowEx(
            0,
            szAppName,
            "Hello, world!",
            WS_OVERLAPPEDWINDOW|WS_VISIBLE,
            300,
            100,
            400,
            400,
            NULL,
            NULL,
            0,
            NULL);

    This is not necessarily a problem with the language, but
    rather a poorly defined interface (not uncommon with windows).

    12 arguments to a function is a bit over the top.

    Not that windows engineers have a stellar reputation for
    application programming interface design.


    Even without named arguments, just default values, but allowing trailing
    arguments only to be omitted, those last 4 arguments can be dropped.

    It is up to the C programmer to write this in a clear and maintainable
    way. I agree that named parameters could make that task easier.

    Fewer parameters to an interface also makes the task easier.

    Let's not pretend that MS's API's are good examples of clear design!

    Bingo.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)