<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>C-Lang on SamsiFPV</title>
    <link>https://samsifpv.ch/tags/c-lang/</link>
    <description>Recent content in C-Lang on SamsiFPV</description>
    <image>
      <title>SamsiFPV</title>
      <url>https://samsifpv.ch/images/papermod-cover.png</url>
      <link>https://samsifpv.ch/images/papermod-cover.png</link>
    </image>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <copyright>Marlon Tanner</copyright>
    <lastBuildDate>Tue, 13 Aug 2024 21:13:45 +0200</lastBuildDate>
    <atom:link href="https://samsifpv.ch/tags/c-lang/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Common GCC Attributes</title>
      <link>https://samsifpv.ch/wiki/gcc-attributes/</link>
      <pubDate>Tue, 13 Aug 2024 21:13:45 +0200</pubDate>
      <guid>https://samsifpv.ch/wiki/gcc-attributes/</guid>
      <description>&lt;h2 id=&#34;function-attributes&#34;&gt;Function attributes&lt;/h2&gt;
&lt;h3 id=&#34;fallthrough&#34;&gt;fallthrough&lt;/h3&gt;
&lt;p&gt;The fallthrough attribute with a null statement serves as a fallthrough
statement. It hints to the compiler that a statement that falls through to
another case label, or user-defined label in a switch statement is intentional
and thus the -Wimplicit-fallthrough warning must not trigger.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;For compatibility with GCC and Clang you can also use &lt;code&gt;// fall through&lt;/code&gt; or
&lt;code&gt;// fallthrough&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;switch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cond&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;case&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nf&#34;&gt;bar&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nf&#34;&gt;__attribute__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;((&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;fallthrough&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;));&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;k&#34;&gt;case&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;err&#34;&gt;…&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;deprecated--deprecated-msg&#34;&gt;deprecated &amp;amp; deprecated (msg)&lt;/h3&gt;
&lt;p&gt;The deprecated attribute results in a warning if the function is used anywhere
in the source file. This is useful when identifying functions that are expected
to be removed in a future version of a program. The warning also includes the
location of the declaration of the deprecated function, to enable users to
easily find further information about why the function is deprecated, or what
they should do instead.&lt;/p&gt;</description>
    </item>
    <item>
      <title>What is the difference between `char a[]` and `char *p`</title>
      <link>https://samsifpv.ch/wiki/difference-chararray-charpointer/</link>
      <pubDate>Wed, 28 Feb 2024 21:24:23 +0200</pubDate>
      <guid>https://samsifpv.ch/wiki/difference-chararray-charpointer/</guid>
      <description>&lt;h2 id=&#34;the-array-version&#34;&gt;The Array version:&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kt&#34;&gt;char&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[]&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;#34;string&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Creates an array that is large enough to hold the string literal &lt;code&gt;string&lt;/code&gt;, including its &lt;code&gt;NULL&lt;/code&gt; terminator. The array string is initialized with the string literal &lt;code&gt;string&lt;/code&gt;. &lt;strong&gt;The array can be modified at a later time.&lt;/strong&gt; Also, the array&amp;rsquo;s size is known even at compile time, so &lt;code&gt;sizeof&lt;/code&gt; &lt;strong&gt;operator can be used to determine its size.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&#34;the-pointer-version&#34;&gt;The pointer version:&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kt&#34;&gt;char&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;p&lt;/span&gt;  &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;#34;string&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Creates a pointer to point to a string literal &amp;ldquo;string&amp;rdquo;. This is faster than the array version, &lt;strong&gt;but string pointed by the pointer should not be changed&lt;/strong&gt;, because it is located in a read only implementation-defined memory. Modifying such an string literal results in &lt;strong&gt;Undefined Behavior&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
