Did you know you can use C/C++ ternary operators without having to repeat the 1st value?
This:
```
int x = 1;
int y = x ?: 2;
printf("y is %d\n", y);
```
is valid code and prints "y is 1".
Basically makes it work alike the Javascript "let a = b || c" syntax.
Neat 🌅
@pettter I think this is intentionally, makes it very handy for stuff like:
```
const char* someval = getenv("MYVAR") ?: "fallback";
```
It seemed quite weird at first to me too, but now I cherrish it.
There are no compiler warnings around it even in release/optimized builds, so I assume it is either an official feature or some compiler extensions.
It works on both GCC and Clang by the way
@falktx I dunno it feels like there's going to be some very big potential type casting problems lurking in there. Lovely as long as you're only working with ints, but I'd be cautious to stray beyond that.
@falktx x=3 ?
@falktx unfortunately it's a gcc language extension. It would be great to have this in the language proper so it could be used everywhere.
@falktx My 'undefined behaviour' sense is tingling here, but that might be a false positive?