• @ttmrichter
    link
    12 years ago

    C is a great language for learning systems programming, because it exposes you to all the nuts and bolts of memory, interrupts, system calls, etc.

    C does nothing of the kind. For a trivial example, in the C world (which is to say the C language, not the hacked-on extras specific to each compiler) memory is uniform and is logically contiguous and byte-addressable.

    I work with an MCU that confounds that right out of the gate with three different kinds of memory (SRAM, Flash, EEPROM) in different address blocks (four blocks of SRAM alone!) each with different characteristics for caching, reading, writing, peripheral availability (especially DMA), and power consumption (the blocks are called “power domains” after all). It also supports externally-connected DRAM, SRAM, EEPROM, and Flash chips with wildly different performance and addressing characteristics each while semi-transparently mapping into the address space in different ways.

    Absolutely NOTHING in C, without external tooling (like link editors with linker scripts) and language extensions (like section placements and secretive runtime components that do the mapping magic for external memory behind the scenes), exposes you to this in the slightest. The closest you get is that some C compilers (not all by any means!) will, through magic backdoor access to the linker, put const variables into Flash (which, given that constant variables in C aren’t, can lead to problems in “tricky” code constructs) and some C runtimes will magically (again with backdoor linker access) put in the code needed to transparently map external memory.

    Hell, higher-level languages like Ada give you better exposure to these things!

    And maybe I’m mistaken, but I doubt I am: could you point me to where in the C standard you’re given exposure to interrupts and system calls in the language? Or even in the C Standard Library?

    (#pragma invocations don’t count: they’re by definition non-standard extensions to C.)

  • @N0b3d
    link
    12 years ago

    In summary: ‘I like X. I do not like Y. Therefore X is the greatest and Y is rubbish.’

    Okay then.

    • @ttmrichter
      link
      12 years ago

      This is the core of most technical arguments in programming.