<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[What is the most correct code]]></title><description><![CDATA[<p dir="auto">Hello,<br />
Anyone know what is the most correct code for the Esp32 and Arduino, since they both work</p>
<p dir="auto">if ((gp_bit0) == 1 &amp;&amp; (f_pat) == 0) {<br />
or<br />
if ((gp_bit1 == 1) &amp;&amp; (f_pat == 0)) {</p>
<p dir="auto">Thanks<br />
Regards</p>
]]></description><link>https://forum.gui-o.com/topic/136/what-is-the-most-correct-code</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 05:57:34 GMT</lastBuildDate><atom:link href="https://forum.gui-o.com/topic/136.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 15 Apr 2023 15:48:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to What is the most correct code on Sat, 15 Apr 2023 16:36:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/4">@kl3m3n</a>,</p>
<p dir="auto">Thank you</p>
<p dir="auto">Best regards</p>
]]></description><link>https://forum.gui-o.com/post/550</link><guid isPermaLink="true">https://forum.gui-o.com/post/550</guid><dc:creator><![CDATA[Sato]]></dc:creator><pubDate>Sat, 15 Apr 2023 16:36:13 GMT</pubDate></item><item><title><![CDATA[Reply to What is the most correct code on Sat, 15 Apr 2023 16:23:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/8">@Sato</a> Hi.</p>
<p dir="auto">You can check out the operator precedence table, e.g.,:<br />
<a href="https://en.cppreference.com/w/cpp/language/operator_precedence" rel="nofollow ugc">https://en.cppreference.com/w/cpp/language/operator_precedence</a></p>
<p dir="auto">You can see that the equality operator has higher precedence than logical AND. So, you can omit the inner brackets...</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/8">@Sato</a> said in <a href="/post/546">What is the most correct code</a>:</p>
<blockquote>
<p dir="auto">if ((gp_bit0) == 1 &amp;&amp; (f_pat) == 0)</p>
</blockquote>
<p dir="auto">This does not make sense and decreases readability (at least for me).</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/8">@Sato</a> said in <a href="/post/546">What is the most correct code</a>:</p>
<blockquote>
<p dir="auto">if ((gp_bit1 == 1) &amp;&amp; (f_pat == 0))</p>
</blockquote>
<p dir="auto">I usually follow this logic as this exactly shows your intention. Although I would rather use:</p>
<pre><code>if (gp_bit1 &amp;&amp; !f_pat)
</code></pre>
<p dir="auto">since you are basically using boolean values. If you are using C, you can use use defines for "true" and "false":</p>
<pre><code>typedef int bool;
#define true 1
#define false 0

bool gp_bit1 = true, f_pat = false;

if ((gp_bit1 == true) &amp;&amp; (f_pat == false))
</code></pre>
<p dir="auto">C++ supports boolean values.</p>
<p dir="auto">Regards,<br />
kl3m3n</p>
]]></description><link>https://forum.gui-o.com/post/547</link><guid isPermaLink="true">https://forum.gui-o.com/post/547</guid><dc:creator><![CDATA[kl3m3n]]></dc:creator><pubDate>Sat, 15 Apr 2023 16:23:10 GMT</pubDate></item></channel></rss>