<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.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/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12666/problem-with-designated-initializers-in-sdk-when-using-c</link><description>Hi, 
 I want to program the nrf51822 with C++ and from what I&amp;#39;ve found here it should be possible. 
 But nrf_drv_gpiote.h contains designated initializers wich aren&amp;#39;t supported by C++. I&amp;#39;m including all SDK headers inside an extern &amp;quot;C&amp;quot; {...} block but</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Mar 2016 10:02:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12666/problem-with-designated-initializers-in-sdk-when-using-c" /><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48133?ContentTypeID=1</link><pubDate>Tue, 22 Mar 2016 10:02:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a54b6e1-c33b-41c7-a560-32b5f40f2828</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Yes, the dev team use C, so C++ issues will not be detected. The SDK (and SoftDevice headers) are provided in C. Porting to C++ should be relatively easy, but it would require some workarounds because of subtle differences. Any input on what we can do to improve C++ compatibility is appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48132?ContentTypeID=1</link><pubDate>Sun, 20 Mar 2016 00:28:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78443f71-328a-42d2-ac7f-a2e51caa088f</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I don&amp;#39;t think the dev team use C++ so they don&amp;#39;t see issues which break (I&amp;#39;d guess the designated init problems are just new fields added to a C-struct, that doesn&amp;#39;t matter in C, but trips up C++ until you change the initialiser and add the new ones in order). I don&amp;#39;t think that&amp;#39;s going to change but just open a support case on &amp;#39;My Page&amp;#39; if you find issues like this and they usually do get fixed within a release or two of the SDK. The asm issue has been remarkably long-running, few take that long, they did actually try to fix it in the most recent SDK release, but got the cast wrong because c++ has its own peculiar rules about when it uses shorts for things, C packs the enums into a byte.&lt;/p&gt;
&lt;p&gt;You really should find there are only a few issues using the SDK with C++ and you learn them very quickly. I still wish there were extern &amp;quot;C&amp;quot; in all the header files but .. you just put it in the code&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48131?ContentTypeID=1</link><pubDate>Sun, 20 Mar 2016 00:19:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4502217-dd34-44ea-b67d-963c8335da41</guid><dc:creator>zrrr</dc:creator><description>&lt;p&gt;Thanks for the link! I tried the search but couldn&amp;#39;t find anything for the designated initializer problem (though i found threads for the asm problem).&lt;/p&gt;
&lt;p&gt;It might be a good idea to prioritize C++ compatibility and ISO C/C++ conformity in future versions as (judging from the amount of unfixed problems/complaints) both seem to currently be a very low priority to the dev team.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48130?ContentTypeID=1</link><pubDate>Sat, 19 Mar 2016 23:53:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efc35181-ef09-4512-bef4-a6d09cfaa908</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;and try the search - all this is discussed constantly in lots of threads, with fixes and workarounds and advice. Search box is ^^ up there&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48129?ContentTypeID=1</link><pubDate>Sat, 19 Mar 2016 23:53:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19f6abf9-ad63-4d0b-ad2c-adeb5fe78a7c</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;yeah that&amp;#39;s a known bug, the cast in there is to uint8_t instead of uint16_t. We discuss this every time a new SDK release comes out. it&amp;#39;s currently on the list of known issues and may get fixed one day. Until then, modify the file to say uint16_t and continue on with the day.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/question/71366/what-are-sdk-1100-known-issues/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You&amp;#39;ll come across a few more here and there but they&amp;#39;re all pretty trivial, although the designated initialisers are annoying.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48128?ContentTypeID=1</link><pubDate>Sat, 19 Mar 2016 23:48:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bf9f3ed-ad84-458b-8c1f-88709512d77b</guid><dc:creator>zrrr</dc:creator><description>&lt;p&gt;sdk/components/softdevice/s110/headers/nrf_svc.h:57:6: error: impossible constraint in &amp;#39;asm&amp;#39;&lt;/p&gt;
&lt;p&gt;But I also get more &amp;quot;asm operand 0 probably doesn&amp;#39;t match constraints&amp;quot; warnings than I can count in other softdevice headers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48127?ContentTypeID=1</link><pubDate>Sat, 19 Mar 2016 23:39:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa6290db-48fc-40b2-b0a2-99125d02fb98</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;which assembler? Most of the C++/g++ assembler problems are well-known and documented here in the forums and lots of us use pretty much only C++, so it&amp;#39;s quite do-able.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48126?ContentTypeID=1</link><pubDate>Sat, 19 Mar 2016 23:36:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca69eca8-7769-4cc0-b811-0090fcb330ba</guid><dc:creator>zrrr</dc:creator><description>&lt;p&gt;That I can fix this by modifying the macro is obvious but i wanted a more general approach as the SDK uses designated initializers in many places and I don&amp;#39;t want to reimplement/modify too much in the SDK. I temporarily fixed it by filling the struct manually instead of using the macro just to run into the next problem. Some inline assembler statements don&amp;#39;t work with g++ and throw compile errors. Seems like the SDK was never designed with C++ in mind. That is sad as I really liked the SDK (especially the exceptionally good documentation compared to other manufacturers) but C++ support is mandatory for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with Designated Initializers in SDK when using C++</title><link>https://devzone.nordicsemi.com/thread/48125?ContentTypeID=1</link><pubDate>Sat, 19 Mar 2016 23:18:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:820e26d3-4d57-48de-af55-f63dfddcb28c</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Change the macro to fill in all the fields properly in order and use that instead of the one in the SDK.&lt;/p&gt;
&lt;p&gt;Importing inside an extern &amp;quot;C&amp;quot; {} block won&amp;#39;t help as that just works for the definition of the macro, it doesn&amp;#39;t help when you use it which is in &amp;#39;c++&amp;#39; context.&lt;/p&gt;
&lt;p&gt;Or factor out the functions you use it in and make them extern &amp;quot;C&amp;quot; {}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>