[vlc-devel] [PATCH 06/21] input/stream: stream-fragments: add vlc_stream_CreateFragmentMRL

Rémi Denis-Courmont remi at remlab.net
Mon Aug 1 18:07:02 CEST 2016


Le lundi 1 août 2016, 11:29:53 Denis Charmet a écrit :
> On 2016-08-01 11:18, Filip Roséen wrote:
> > In my opinion this certainly is one of those functions where passing
> > NULL does not make a lot of sense philosophical speaking, and I am
> > semi-against adding checks that simply protects something from invalid
> > usage (instead of explicitly saying that such usage is
> > ill-formed/undefined).
> 
> In my opinion you should *never* trust whatever you get from a public
> API.

Sure, when writing system calls or remote procedure calls back-ends.

In C/C++ code, within a unique process and program, you must trust the caller. 
Your likings does not matter here; that's just how the programming model of 
those languages is. Otherwise. you will get undefined behaviour, no matter how 
many silly "defensive programming" checks you add.

Defensive programming does three things: make the code more confusing, 
incentivise cargo cult, and make debugging harder by concealing bugs. We have 
had a lot of problems with that nonsense in the past.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list