• SpaceNoodle@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      10 months ago

      Well, that means that it’s also a C++ thing, but streams are an even slicker concept that aren’t a C thing, making higher-level code look nice and shiny - and abstracting away loads of I/O pain points while encapsulating useful features.

      • solrize@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        10 months ago

        C++ streams are ugly in their own right, but C++ preferred practice these days is to treat it as its own language rather than as a C superset. That is, lots of crufty old C stuff still works in C++ for legacy reasons, but using it when you don’t have to is considered inappropriate.

        • Skull giver@popplesburger.hilciferous.nl
          link
          fedilink
          arrow-up
          0
          ·
          10 months ago

          The real fun about treating C++ as a superset of C begins when you run into cases where the languages differ.

          I’m not talking about classes and templates and stuff like that either, I’m talking about relatively simple syntax that people expect to be present in both languages.

          if (1) int a = 42;
          

          is valid C++, but will not valid C. That’s because the definition of a what a statement is differs between the two and has since the 80s!