‹ BackHN Continuity

Thread

C's Flexible Integer Sizes Were Not a Design Mistake

113 points · 166 comments · ibobev

  1. quelsolaar · · focus · HN ↗
    Good article.

    C would probably not have survived unless it had this flexibility.

    But its not justa historical thing. Today there are modern platforms like DSPs that have 32bit sized char, because that is the smallest addressable type. These platforms depend on C for tool chains, even if most "portable" C wont run correctly on them. The fact that you can build hardware like that, and not have to invent a new language / dialect to program them is a huge win for the world.

    <edit> I didnt see the footnote about DSPs at first read </edit>

    1. pjmlp · · focus · HN ↗
      C survived because UNIX carried it.
      1. flohofwoe · · focus · HN ↗
        I don't agree. UNIX was an extremely niche operating system until Linux won the data center, at that time both C and C++ were already extremely popular outside the UNIX world. C won because it was so easy to adapt to new hardware architectures (even GPU shading languages are just minimally extended flavours of C and C++).
        1. prerok · · focus · HN ↗
          Sorry, what? Most of data centers were running a UNIX operating system back in the day. What operating system do you think they were running?
          1. tialaramex · · focus · HN ↗
            There is a weird moment toward the end of the 1990s when Microsoft is trying to show their NT is a serious competitor in this space.

            Traditionally this was a profitable niche, Microsoft would like to take a fat piece of that, and instead what happened is that Linux destroyed the profit margin. A million dollars overhead that would have kept a hungry UNIX® vendor alive on your project didn't turn into an extra million dollars on Microsoft's balance sheet, instead it evaporated because Linux is "free". And so then Microsoft lost interest.

            1. pjmlp · · focus · HN ↗
              Yeah, and one of the ways to show it was a serious OS for DoD projects was to have a POSIX subsystem, which had they kept it around, Linux would never have taken off on the PC, and there would be no need for WSL 40 years later.
              1. tialaramex · · focus · HN ↗
                The POSIX subsystem is a box checking exercise. The reason the box was there isn't satisfied but the box was checked and Microsoft hoped that's good enough. If you need "a Unix" and they give you NT and circle the stuff about POSIX you don't go "Oh, perfect" you ask them to fix the requirements document so that you can have an actual Unix next time.

                WSL is Redmond going OK yeah, here you go, an actual Unix.

                1. pjmlp · · focus · HN ↗
                  There was also SUA and Interix in the meantime, before WSL came to be.

                  The point still stands, that POSIX checkbox was relevant enough for spending the money in engineers salary during Windows NT 3.51 development.

                  1. someonebaggy · · focus · HN ↗
                    It was a requirement on government contract tenders. If you didn't support POSIX, you didn't get the contract and the government would have continued using SunOS or AIX or something instead of Windows NT. Remember that POSIX was designed to make these OSes somewhat interchangeable - they wouldn't order something they knew was incompatible with everything they already had.
                    1. pjmlp · · focus · HN ↗
                      Exactly, thus UNIX/POSIX being everywhere that mattered, alongside the language created to make UNIX portable, C.

                      For those that don't read standards, POSIX certification requires the existence of a C compiler, the more recent one being C17 compliant.

                      <a href="https:&#x2F;&#x2F;pubs.opengroup.org&#x2F;onlinepubs&#x2F;9799919799&#x2F;utilities&#x2F;c17.html" rel="nofollow">https:&#x2F;&#x2F;pubs.opengroup.org&#x2F;onlinepubs&#x2F;9799919799&#x2F;utilities&#x2F;c...

            2. iberator · · focus · HN ↗
              Worth to mention that in the 80&quot; Microsoft was the biggest UNIX vendor with their XENIX operating system:)
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.