<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>C++ friend functions</title><link>/technologies/code_exchange/b/blog/posts/c-friend-functions</link><description>For an embedded design, I made a featherweight class. A C++ construct that used no more data or code size than a traditional C design.
class command {
public:
 inline command(uint32_t steps, bool reverse) : cmd_(steps &amp;lt;&amp;lt; 1 |...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: C++ friend functions</title><link>https://community.element14.com/technologies/code_exchange/b/blog/posts/c-friend-functions</link><pubDate>Sun, 18 May 2025 20:23:53 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:4136aa90-c95b-4d43-886f-493a518b3641</guid><dc:creator>DAB</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;New declaration for me.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28908&amp;AppID=74&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: C++ friend functions</title><link>https://community.element14.com/technologies/code_exchange/b/blog/posts/c-friend-functions</link><pubDate>Sun, 18 May 2025 17:59:42 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:4136aa90-c95b-4d43-886f-493a518b3641</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;For the compiler (with optimisation on) it doesn&amp;#39;t matter if you use a friend or an inline non-virtual class member&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="229" src="/resized-image/__size/1000x458/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-4136aa90-c95b-4d43-886f-493a518b3641/pastedimage1747591092828v1.png" width="500" /&gt;&lt;/p&gt;
&lt;p&gt;Isn&amp;#39;t it amazing how much abstraction&amp;nbsp;you can get for free? The compiler translates both examples as if you just wrote this:&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:ad9892b0-4f0d-4f54-aa89-db2233e093e6:type=c_cpp&amp;text=int%20main%28%29%20%7B%0A%20%20%20%20return%20200%3B%0A%7D]&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28908&amp;AppID=74&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: C++ friend functions</title><link>https://community.element14.com/technologies/code_exchange/b/blog/posts/c-friend-functions</link><pubDate>Sun, 18 May 2025 13:35:13 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:4136aa90-c95b-4d43-886f-493a518b3641</guid><dc:creator>shabaz</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Very interesting! I&amp;#39;ve not used the friend declaration before (I don&amp;#39;t think it was very prevalent when I&amp;nbsp;coding in C++), so it&amp;#39;s new to me. And looks a lot cleaner than having to resort to &amp;#39;setter&amp;#39; and &amp;#39;getter&amp;#39; type methods!&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=28908&amp;AppID=74&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>