> -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-boun...@ffmpeg.org> On Behalf Of > Nicolas George > Sent: Donnerstag, 24. April 2025 16:47 > To: FFmpeg development discussions and patches <ffmpeg- > de...@ffmpeg.org> > Subject: [FFmpeg-devel] On errors, asserts and crashing (was: Shaping > the AVTextFormat API Surface) > > softworkz . (HE12025-04-22): > > At the implementation level, I sensed that "you" ("FFmpeg") > > are following some principles which are somewhat contradictive to > > those that I'm usually adhering to (e.g. "parameter validation > > being a responsibility of the call site, crashing otherwise > > being acceptable"). Nonetheless, I'm the one who has to adapt, > > and I'm not going to question that. > > I am feeling didactic, so I will write what I have to say on the topic > in full details, so that it can also serve as future reference. > > Crashing immediately when some unexpected condition happens is not a > quirk of a few FFmpeg developers, it is very often the only way to do > things and also often better than any available alternative. Knowing > what to do when it is only an option is not always obvious, but this > is > FFmpeg, not some management software project developed by engineers > fresh from an average school.
Once and for all, just GTFO from those kinds of comments. I do have an academic background and the university were considered to be among the top 10 in the world for Computer Science at that time. The only reason why I haven't become "Dr. Softworkz" is because I had no interest in teaching other students and I already had a running business with earnings way above, hence I had rejected the offer. I'm showing interest in your views of parameter validation in the context of Ffmpeg - nothing less, but also nothing more, so we can skip fundamentals. […] > So: do nothing / assert, or return an error? This is the point where > there is no longer an easy answer. Which is why I'm asking about it. > It requires weighting the pros and > the cons. The only thing I can do is make a list of a few > considerations > that affects the weighting of the pros and cons. Sure. But what I've been asking about are some very specific cases only. > To summarize: Deciding what to do when invalid values are met requires > properly understanding the invariant requirements of the program and > doing a cost-analysis of the options, including whether the rest of > the > code can easily enforce those invariants and whether it can do > something > graceful with an error. I have nothing to object about your elaboration, besides that it's missing out on the concept of structured exception handling, which is an intrinsic feature of many programming languages, offering the undeniable advantage of being able to recover from "exceptional" situations instead of crashing. Thanks sw _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".