<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic -fsigned-char not working? in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590157#M28985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by KevinWMatthews on Thu Mar 20 10:40:31 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm running a project in version 6.1.4 and have haven't been able to get the -fsigned-char compiler flag to take effect. I have entered the flag under both MCU C++ Compiler-&amp;gt;Miscellaneous-&amp;gt;Other Flags and MCU C Compiler-&amp;gt;Miscellaneous-&amp;gt;Other Flags.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been testing this using the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#include &amp;lt;limits.h&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#if CHAR_MIN &amp;lt; 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#warning( "default char is signed" )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#warning( "default char is unsigned" )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The "unsigned" warning is shown.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas on how to force the default value for char to be signed?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:45:49 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:45:49Z</dc:date>
    <item>
      <title>-fsigned-char not working?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590157#M28985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by KevinWMatthews on Thu Mar 20 10:40:31 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm running a project in version 6.1.4 and have haven't been able to get the -fsigned-char compiler flag to take effect. I have entered the flag under both MCU C++ Compiler-&amp;gt;Miscellaneous-&amp;gt;Other Flags and MCU C Compiler-&amp;gt;Miscellaneous-&amp;gt;Other Flags.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been testing this using the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#include &amp;lt;limits.h&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#if CHAR_MIN &amp;lt; 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#warning( "default char is signed" )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#warning( "default char is unsigned" )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The "unsigned" warning is shown.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas on how to force the default value for char to be signed?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:45:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590157#M28985</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: -fsigned-char not working?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590158#M28986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Thu Mar 20 10:59:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;In GCC, the symbol &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;__CHAR_UNSIGNED__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is defined as 1 for unsigned (the default) or is undefined when you use -fsigned-char&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i.e. The compiler does as you ask, but your check is wrong.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:45:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590158#M28986</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: -fsigned-char not working?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590159#M28987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by KevinWMatthews on Fri Mar 21 15:40:29 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Shouldn't having __CHAR_UNSIGNED__ undefined result in CHAR_MIN being defined as SCHAR_MIN? After looking in limits.h (under newlib_fixed), the code seems to point to this happening. However, this isn't the behavior that I observe.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code that I'm referring to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;#ifdef __CHAR_UNSIGNED__&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;# undef CHAR_MIN&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;# if __SCHAR_MAX__ == __INT_MAX__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#&amp;nbsp; define CHAR_MIN 0U&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;# else&lt;BR /&gt;#&amp;nbsp; define CHAR_MIN 0&lt;BR /&gt;# endif&lt;BR /&gt;# undef CHAR_MAX&lt;BR /&gt;# define CHAR_MAX UCHAR_MAX&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;#else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# undef CHAR_MIN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# define CHAR_MIN SCHAR_MIN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# undef CHAR_MAX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# define CHAR_MAX SCHAR_MAX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code in bold executes regardless of the state of -fsigned-char.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've attached the limits.h file that I'm referring to. Perhaps I'm looking in the wrong place?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:45:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590159#M28987</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: -fsigned-char not working?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590160#M28988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Sat Mar 22 07:13:23 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;You are probably using Redlib rather than Newlib. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fredlib-and-newlib" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/redlib-and-newlib&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Redlib implementation of limits.h assumes that char is unsigned (as is standard on ARM).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would suggest that you might be better off changing you code to explictly use unsigned and signed chars (or better still use the types defined in &lt;/SPAN&gt;&lt;STRONG&gt;stdint.h &lt;/STRONG&gt;&lt;SPAN&gt;such as &lt;/SPAN&gt;&lt;STRONG&gt;int8_t&lt;/STRONG&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;STRONG&gt;uint8_t&lt;/STRONG&gt;&lt;SPAN&gt;) rather than using the -fsigned-char option to force the signedness of 'char'.&amp;nbsp; Doing this will prevent possible similar implementation issues of this type in the future with your codebase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:45:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590160#M28988</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: -fsigned-char not working?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590161#M28989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by KevinWMatthews on Mon Mar 24 10:44:25 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are planning to go back and use more explicit variable types. It's a bit of a project, sadly, but it seems like the way to go.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm still curious about the -fsigned-char issue. As far as I can tell we are using Newlib. I read through &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fswitching-selected-c-library" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/switching-selected-c-library&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to verify that we had Newlib selected there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also looked at our linker script file and found that we appear to be using Newlib (Nohost):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GROUP(libgcc.a libc.a libstdc++.a libm.a libcr_newlib_nohost.a crti.o crtn.o crtbegin.o crtend.o)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(taken from our .ld file).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:45:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590161#M28989</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: -fsigned-char not working?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590162#M28990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Mon Mar 24 15:22:28 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;What are the options given to the compiler? (Not the linker.) Look in the build log to see what options are supplied.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:45:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590162#M28990</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: -fsigned-char not working?</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590163#M28991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Tue Mar 25 02:35:10 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I see no problems in my testing here with the values from Newlib's&amp;nbsp; limits.h being picked up when code is compiled with -fsigned-char. I suggest you check you build log to ensure that the option is being passed into the compiler in your project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fbuild-console" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/build-console&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are convinced there is an issue here, then please post a simple buildable example project that shows it up:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fhow-importexport-projects" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/how-importexport-projects&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[We will investigate updating Redlib's definitions of limits.h to cope with building for signed chars for a future release.]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:45:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/fsigned-char-not-working/m-p/590163#M28991</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:45:52Z</dc:date>
    </item>
  </channel>
</rss>

