News for hackers. Stuff that matters.
Re:Banned C standard library functions in Git source code by slovenlyrobot on Sunday August 25, 2019 @11:14AM (#20793413)
These are used /everywhere/ in PostgreSQL, exactly for exception handling. The result isn't bad at all, but indeed, too powerful a tool for 99% of developers
Re:Banned C standard library functions in Git source code by CamperBob2 on Sunday August 25, 2019 @04:13PM (#20795258)
Fortunately, 99% of developers, like 99% of drivers, are better than average.
Re:Banned C standard library functions in Git source code by cmroanirgo on Sunday August 25, 2019 @06:39PM (#20796081)
> 99% ... are better than average.

I'm thinking there's a flaw in your mathematics...

Re:Banned C standard library functions in Git source code by elgenie on Sunday August 25, 2019 @07:04PM (#20796218)
99% of the people on Earth have a higher than average number of legs.
Re:Banned C standard library functions in Git source code by saalweachter on Monday August 26, 2019 @09:56AM (#20799882)
And a below-average number of heads.
Re:Banned C standard library functions in Git source code by mrbungie on Sunday August 25, 2019 @06:47PM (#20796122)
No flaw with math/stats here, that can actually happen. I think you're confusing average/mean with median (50-percentile).

PS: I'm not sure where he's getting his numbers though

Re:Banned C standard library functions in Git source code by sooheon on Sunday August 25, 2019 @07:04PM (#20796214)
I'm 99% sure that was tongue in cheek.
Re:Banned C standard library functions in Git source code by jraph on Sunday August 25, 2019 @09:36PM (#20796868)
I think that it would have been even funnier to say that 99% of developers and 99% of drivers are better than the median, but I only figured this thanks to your parent's comment.
Re:Banned C standard library functions in Git source code by aiCeivi9 on Monday August 26, 2019 @10:41AM (#20800249)
https://insights.stackoverflow.com/survey/2019#evaluating-co...

> 70% of respondents say they are above average

Re:Banned C standard library functions in Git source code by dragonwriter on Monday August 26, 2019 @12:30PM (#20801163)
Depends which average it refers to any of the means, or the media, or the mode can be “average” (most typically, though, it means the arithmetic mean), and it's only impossible in terms of the median.
Re:Banned C standard library functions in Git source code by LorenPechtel on Monday August 26, 2019 @01:00PM (#20801516)
Exactly. Anything where you have a main clump with a long tail will show this pattern--most samples will be better than the mean.
Re:Banned C standard library functions in Git source code by Stratoscope on Sunday August 25, 2019 @10:58PM (#20797137)
You've never been on a project that was 80% done and 80% to go?
Re:Banned C standard library functions in Git source code by ConceptJunkie on Monday August 26, 2019 @12:19PM (#20801067)
And after the second 80% is finished, then you only have 80% left.
Re:Banned C standard library functions in Git source code by Merg on Monday August 26, 2019 @04:31AM (#20798229)
Not native speaker here, but I think, he just meant that, most programmers and drivers thinks they are better in respective things then, they really are.

It is just like letting programmer build a house. It is just a really bad idea.

Re:Banned C standard library functions in Git source code by fanf2 on Sunday August 25, 2019 @04:08PM (#20795219)
And Lua’s exceptions are somewhat odd because they are based on setjmp/longjmp. https://www.lua.org/manual/5.3/manual.html#4.6
Re:Banned C standard library functions in Git source code by masklinn on Monday August 26, 2019 @03:34AM (#20798066)
Apparently they're also used for error handling in libpng. That's one of the reasons the libspng author started on their project.
Re:Banned C standard library functions in Git source code by crankylinuxuser on Sunday August 25, 2019 @11:49AM (#20793578)
And that's the perfect usage for goto. Error catching and jump to fail block...
Re:Banned C standard library functions in Git source code by johannes1234321 on Sunday August 25, 2019 @01:26PM (#20794181)
Goto requires the fail block to be in the same frame. It can be a working error strategy for failing critical errors in such a way from a failing module. You have to be aware that lots of stuff is prone to leak (which can be avoided by i.e. using some memory arena) and locks/mutexes/... might be in unclear state, so code has to be aware of that.
Re:Banned C standard library functions in Git source code by userbinator on Sunday August 25, 2019 @01:57PM (#20794410)
The destination of the goto is usually the clean-up code.
Re:Banned C standard library functions in Git source code by johannes1234321 on Sunday August 25, 2019 @06:46PM (#20796116)
That's nice for the single frame.

Let's take the example of PostgreSQL, which was mentioned in this thread: A potential implementation (I have no knowledge of pgsql internals) might be that for a single user session all memory is from a single arena, all locks and other handles are tied to the session handle, then it can be an efficient strategy to longjmp out on a critical error (i.e. IO error) and clean the arena as well as things tied to the session. instead of bubbling this up through all frames.

Re:Banned C standard library functions in Git source code by Mikhail_Edoshin on Monday August 26, 2019 @02:46AM (#20797919)
It's a different use case. There was a nice article[1] about exceptions in plain C with setjmp and longjmp.

[1] http://www.on-time.com/ddj0011.htm

Re:Banned C standard library functions in Git source code by IshKebab on Sunday August 25, 2019 @01:27PM (#20794192)
You're in the 1% though right?

Funny way of saying "too error-prone for anyone sane to consider using".