<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 23, 2021 at 12:58 PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 23/03/2021 18:48, Joel Sherrill wrote:<br>
<br>
> My first thought is that I don't like covering up for applications <br>
> that do the wrong thing.<br>
This topic just came up recently in a discussion about defensive <br>
programming. We also test for NULL pointers.<br>
><br>
> I'm overall rather ambiguous. It is possible that setting the value at <br>
> the top of the function could lead to overridden before used issues <br>
> with warnings and static analysis.<br>
<br>
You mean code like this:<br>
<br>
void (int *x, int y)<br>
<br>
{<br>
<br>
*x = 0;<br>
<br>
if (y) {<br>
<br>
*x = 1;<br>
<br>
} else {<br>
<br>
*x = 2;<br>
<br>
}<br>
<br>
?<br></blockquote><div><br></div><div>Yep. That's a pretty clear case. <br><br>Others should speak up but I just don't want the solution pattern</div><div>to introduce warnings or static analysis reports. It easily could.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> I don't want to see every error case assign a value to an output <br>
> parameter though.<br>
Yes, I don't like this also.<br></blockquote><div><br></div><div>I have my own wish list for error paths eventually if we ever get bored. :)</div><div><br></div><div><br></div><div>--joel</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
-- <br>
embedded brains GmbH<br>
Herr Sebastian HUBER<br>
Dornierstr. 4<br>
82178 Puchheim<br>
Germany<br>
email: <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a><br>
phone: +49-89-18 94 741 - 16<br>
fax: +49-89-18 94 741 - 08<br>
<br>
Registergericht: Amtsgericht München<br>
Registernummer: HRB 157899<br>
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler<br>
Unsere Datenschutzerklärung finden Sie hier:<br>
<a href="https://embedded-brains.de/datenschutzerklaerung/" rel="noreferrer" target="_blank">https://embedded-brains.de/datenschutzerklaerung/</a><br>
<br>
</blockquote></div></div>