toot.wales is one of the many independent Mastodon servers you can use to participate in the fediverse.
We are the Open Social network for Wales and the Welsh, at home and abroad! Y rhwydwaith cymdeithasol annibynnol i Gymru, wedi'i bweru gan Mastodon!

Administered by:

Server stats:

657
active users

I dont suppose there's any way to do logical and/or in C without coercing the result to 0 or 1?

I.e. `0 || 5` would result in 5, not 1

EDIT: ternary would work `x ? x : y`

It's so irritating that something as simple as logical and/or isn't the same in different languages :/

In some languages 0 or 5 is 1, in others 0 or 5 is 5

Suppose I could make an inline function like

int or(int x, int y) {
if (x) return x;
return y;
}

EDIT: this won't work cause it'll evaluate both arguments

Giles Goat

@eniko Well yes if you do functions you can do all you want.