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

```c
int c = 1;
int d = c / c++;
```

in GCC, both ints are `2`; in clang, `d` is `1`

@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

@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.

Follow

@tess
spitballing about fucking up decades of volunteer work for shits and giggles.

let's hope for the next round of valley layoffs ✌️
@myrrlyn

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.