Follow

c++, no image desc 

seen in a thread discussing obscure c++ facts:

re: c++, no image desc 

@wallhackio OK, what is this a reaction to?

re: c++, no image desc 

@vaporeon_ a ternary can resolve to an lvalue in c++ so (a < b ? a : b) = 3; is legal

re: c++, no image desc 

@wallhackio Beautiful
Now I'm sad that it doesn't work in C
This compiles in C++, but not in C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int a = 1, b = 2;
srand(time(NULL));
((rand() % 2 == 0) ? a : b) = 3;
printf("%d %d\n", a, b);
return 0;
}

re: c++, no image desc 

@vaporeon_ oh this is evil lmao

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.