Post AS9I9k9zU8Vax1EhAe by sixohsix@icosahedron.website
 (DIR) More posts by sixohsix@icosahedron.website
 (DIR) Post #AS7Biv8LadBn7nNFhY by myrrlyn@tacobelllabs.net
       2023-01-28T18:54:36Z
       
       2 likes, 4 repeats
       
       i can't believe that my shitpost about inspecting the value of the expression `c / c++` to determine what compiler you're on turned out to _actually_ expose a difference between gcc and clang```cint c = 1;int d = c / c++;```in GCC, both ints are `2`; in clang, `d` is `1`
       
 (DIR) Post #AS7BiwGXNfKodUDJ6e by myrrlyn@tacobelllabs.net
       2023-01-28T18:55:02Z
       
       1 likes, 0 repeats
       
       i'm gonna mcfreakin lose it
       
 (DIR) Post #AS9I9k9zU8Vax1EhAe by sixohsix@icosahedron.website
       2023-01-28T18:58:08Z
       
       0 likes, 0 repeats
       
       @myrrlyn is this dreaded "undefined behavior", meaning it only works on these compilers on a specific optimization level and may change in the future?
       
 (DIR) Post #AS9I9kavry3kIZqDAG by myrrlyn@tacobelllabs.net
       2023-01-28T19:04:51Z
       
       1 likes, 0 repeats
       
       @sixohsix i think the evaluation order of multiple sequence points in a single statement is “implementation defined” rather than undefinedwhat’s also cool about this is that clang emits a warning and gcc does not
       
 (DIR) Post #AS9I9l407tJNkjRQTQ by adam@hax0rbana.social
       2023-01-29T22:17:20Z
       
       0 likes, 0 repeats
       
       @myrrlyn @sixohsix Today is one of those days I wish I had my C book so I could check the operator precedence chat on the inside front cover. I thought the post-increment happened after division operations, which would mean that's an error in the compiler.In any case, the fact that they're different... oof.
       
 (DIR) Post #AS9wqeZE9SiqDu3X2u by sixohsix@icosahedron.website
       2023-01-30T05:53:15Z
       
       0 likes, 0 repeats
       
       @adam I think someone else answered that in C the result of this expression is defined, but in C++ it isn't.
       
 (DIR) Post #ASHPnQD4KWqucF4vnk by tess@mastodon.social
       2023-01-28T20:12:57Z
       
       0 likes, 0 repeats
       
       @myrrlyn of course.The rule of thumb with C++ compilers when behavior isn't strictly defined by the language standard is:- gcc will intentionally do the most obtuse possible thing, to punish you for not reading the spec closely enough (git gud you fucking idiot)- the compiler backed by big tech will do the thing you expected to have happen, because they don't hate you and also because they need junior engineers to be able to write code
       
 (DIR) Post #ASHPnQvNfmIWpfoJs0 by saagar@federated.saagarjha.com
       2023-01-29T01:49:53.140994Z
       
       1 likes, 0 repeats
       
       @myrrlyn @tess This has not been true in my experience. One, because the big companies hate you, and two, both compiler authors will absolutely punish you hard for writing ill-formed code. They are almost indistinguishable on this front.
       
 (DIR) Post #ASHPnR2TFPy9Bf7yvA by tess@mastodon.social
       2023-01-29T00:53:11Z
       
       1 likes, 2 repeats
       
       @myrrlyn the real power move would be to contribute code to gcc that subtly relies on one of these adversarial behaviors which is likely to be "fixed" in an upcoming version of the language standard, so that after updating the behavior, it's suddenly not possible to build a reliable version of gcc in gcc.Extra points if it creates extremely subtle bugs that are hard to track down.
       
 (DIR) Post #ASHPnRWxQ4M6iDOKRM by saagar@federated.saagarjha.com
       2023-01-29T01:51:29.236893Z
       
       1 likes, 0 repeats
       
       @tess @myrrlyn Clang used to just stop emitting instructions if it got upset enough. Your “warning” was that you’d find a crash in the function that the one you meant to call fell through to.
       
 (DIR) Post #ASHRsXGjiBDVrjMOOG by bonifartius@freespeechextremist.com
       2023-02-02T20:44:05.578575Z
       
       0 likes, 0 repeats
       
       @tess @myrrlyn "let's sabotage free software projects" - cool google roller derby mom ca. '23, making the world a shittier place.
       
 (DIR) Post #ASHTTYKYpKxjpLMd9s by bonifartius@qoto.org
       2023-02-02T21:01:58Z
       
       0 likes, 1 repeats
       
       @tess spitballing about fucking up decades of volunteer work for shits and giggles.let's hope for the next round of valley layoffs ✌️ @myrrlyn
       
 (DIR) Post #ASKWXUjF2kmN9QMLCq by myrrlyn@tacobelllabs.net
       2023-02-04T08:20:25Z
       
       0 likes, 1 repeats
       
       @bonifartius don’t worry, gcc is well defended from sabotage by virtue of the fact that sabotaging it would require interacting with a gcc maintainer, and nobody wants to do that
       
 (DIR) Post #ASKaunTvsyHFn1Z8BU by bonifartius@freespeechextremist.com
       2023-02-04T09:09:28.849164Z
       
       0 likes, 0 repeats
       
       @myrrlyn :rmsshiggy: mfw not sure if white knight defending googlers or hating fsf because the rms cancelfest didn't work.