Why are exceptions more common than multiple returns?

The Ansi C20 standard is debating whether or not to include multiple returns. Why aren't these more common? They seemingly blow exceptions out of the water.
Sample pseudo-syntax:
(int, bool) unsafe_operation(int a, int b) {
if (bad_thing_happens) {
// (0, true)
err_return true;
}
// (a+b, false)
return a+b;
}

int main() {
int result;
bool error;
(result, error) = unsafe_operation(1,2);
if (error) {
// Data is invalid and should be ignored/handled
} else {
// Data is A-OK
}
return 0;
}

This also has the benfit of being local and only causing execution to go up one level per error.

Attached: hot_pocket_jpeg_artifacts.png (3060x3060, 3.86M)

We already have Go with this shit and it's fucking retarded.

and namespasec please

How is it worse than exceptions?

>3.86 MB image png image of jpeg artifacts

>new c standard
fug nigga i ain usin dat shit
dat c89 is ma nigga boi da fug u niggas tryna do

truly amazing

C11 is comfy though, you can do this shit
struct OP {
char* name;
union {
string postname;
int postnumber;
}
}

struct OP test = {"Homo", .postnumber=1};

yall niggas will get me to stop playn wit ma gang n ma homebois on irc befo u git me on dat shit

multiple returns are just a gay and restricted version of tuples.
Whatever C is proposing won't look nearly as clean as what you posted because it conflicts with existing code (e.g. the comma operator)

Just do this

int unsafe_operation(int *out)
{
if (bad_thing_happens())
return 0;

*out = ...
return 1;
}
int main()
{
int result;

if (!unsafe_operation(&result))
return 1;

/* something with result */
return 0;
}

That's what I have been doing, it just doesn't seem "safe"

Neither is what you're doing. If you want safety, beg for sum types to be added.

Single return error codes + out parameters is the best way because it allows you to conveniently write terse constructs like if (err = unsafe_op(&state))
// handle err

That's... Actually pretty good. Thanks, user.

if c programmers wanted an error handling system they would have moved on over to c++ by now
its safe to say that the vast majority of c programmers dont want it, and if you add it in this standard then the adoption rate of this standard will be near-zero
you struggled to get people to even consider adopting c11 and even then its only adopted because of managers with little technical background telling everyone to use it because he sees it is "new" and "modern" and therefore must be better

>implying managers of any business use C for anything

careful, you'll make the anti-go retards spam sh-- never mind, too late.

It's not. He's sperging out. Fuck him.

Fucking ew. Please stop.

struct better_than_c20 {
int result;
bool error;
};

template
struct BetterThanC89
{
T val;
E err;
};

they dont, which is my point
they tell everyone else to, and what manager says - people do

Gross.

>Why are exceptions more common than multiple returns?
They're not alternatives to each other. Multiple returns have multiple applications.
Consider some examples from CL:
CL-USER> (floor 10 4) ; where 4 is the divisor
2
2

floor() returns two values, the quotinent and the remainder.
CL-USER> (parse-integer " 234 56" :junk-allowed t)
234
5

parse-integer returns the parsed integer, and the index of the last used character in the string. The index can be used for splitting the string for furher parsing.
CL-USER> (defvar table (make-hash-table))
TABLE
CL-USER> (setf (gethash 1 table) 10)
10
CL-USER> (setf (gethash 2 table) nil)
NIL
CL-USER> (gethash 1 table)
10
T
CL-USER> (gethash 2 table)
NIL
T
CL-USER> (gethash 3 table)
NIL
NIL

gethash() returns two values, one for the value stored in the table and another signaling if the hash actually exists in the table. This way you can save a NIL into a hash table, and know that the NIL returned is intentional.
CL-USER> (encode-universal-time 59 59 23 28 12 2010)
3502565999
CL-USER> (decode-universal-time *)
59
59
23
28
12
2010
1
NIL
-1

This could probably be handled better but here's decode-universal-time() returning nine values because why not.

None of this is exception handling.

Attached: 1539202523240.jpg (850x1190, 227K)

>exceptions bad because muh syntax
>proposes less safe alternative with worse syntax

Attached: 1535596927632.png (645x729, 63K)

What is this supposed to mean?
Multiple return statements were always possible.

But returning multiple values from a function?

I confused it with multiple return statements.

It's called anonymous type user, or tuple/arrays, in dynamic pleb langs. The obvious drawback is that it takes more space.