\

your C is not standard C

30 points - last Tuesday at 1:36 PM

Source
  • dzaima

    today at 1:50 AM

    > gcc, however, always defines FLT_ROUNDS to 1

    Well, considering that gcc doesn't support the FENV_ACCESS pragma, and as such all fesetround calls are always UB, it is valid for it to act as if the rounding mode never changes from the default :)

    • MisterTea

      last Tuesday at 9:55 PM

      As someone who loves and enjoys writing Plan 9 c, all I can say is "standard c", whatever that means these days, is a mess. Too many things to name ranging from the only two oss compilers being bloated monsters, post c99 additions being pointless, in-line asm ruining portability*, and POSIX can die in a fire (along with typewriter terminals.)

      I have a friend who is currently on the C committee and is likely going to leave because of all the bad ideas which have both been implemented and going to be implemented.

      * No, spamming a million ugly #ifdefs all over the source files is gross and hard to read. Split up the code dammit.

        • glouwbug

          today at 1:30 AM

          Plan 9 inheritance is really nice. You can still use it with `gcc -fplan9-extensions`. It builds some nice polymorphic workflow an array of tagged enum void pointers

          • 201984

            today at 1:26 AM

            >post c99 additions being pointless

            Atomics are necessary nowadays though.

              • 3836293648

                today at 1:57 AM

                As a part of the language? Are they really? You can do it all with library functions that just take regular int* (and so on).

                Not that I'd want it, I like complex type systems, but I see it as philosophically consistent with C.

                  • aw1621107

                    today at 2:17 AM

                    > You can do it all with library functions that just take regular int* (and so on).

                    It's not just about atomics, but you might still find Hans Boehm's 2005 paper "Threads Cannot Be Implemented As a Library" [0] interesting. It describes (among other things) correctness and performance issues that can arise if the compiler and/or language don't know about thread/atomic semantics.

                    [0]: https://web.stanford.edu/class/archive/cs/cs240/cs240.1236/o...

                    • publicmail

                      today at 2:08 AM

                      A library function written in what? Atomics also come along with memory ordering which isnโ€™t otherwise expressible in the language, as in, there was no standard way to do a โ€œload acquireโ€ before, for example.

          • Syzygies

            today at 2:26 AM

            ...and I thought Go was standard C!