<?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 uchar_t is confusing in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215730#M5357</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;When I read a &lt;FONT color="#808080"&gt;uchar_t&lt;/FONT&gt; data type, I thought it was an &lt;STRONG&gt;u&lt;/STRONG&gt;nsigned &lt;STRONG&gt;char t&lt;/STRONG&gt;ype. But when I look it up on Definisions.hpp, I found out that it is:
&lt;PRE&gt;typedef unsigned short              uchar_t;        // 2-byte unicode charater (UTF16)&lt;/PRE&gt;
Why?????? This is so confusing.&lt;/DIV&gt;</description>
    <pubDate>Tue, 01 Aug 2023 12:05:34 GMT</pubDate>
    <dc:creator>ReignBough</dc:creator>
    <dc:date>2023-08-01T12:05:34Z</dc:date>
    <item>
      <title>uchar_t is confusing</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215730#M5357</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;When I read a &lt;FONT color="#808080"&gt;uchar_t&lt;/FONT&gt; data type, I thought it was an &lt;STRONG&gt;u&lt;/STRONG&gt;nsigned &lt;STRONG&gt;char t&lt;/STRONG&gt;ype. But when I look it up on Definisions.hpp, I found out that it is:
&lt;PRE&gt;typedef unsigned short              uchar_t;        // 2-byte unicode charater (UTF16)&lt;/PRE&gt;
Why?????? This is so confusing.&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Aug 2023 12:05:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215730#M5357</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2023-08-01T12:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: uchar_t is confusing</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215731#M5358</link>
      <description>&lt;BLOCKQUOTE&gt;ReignBough wrote:&lt;BR /&gt;When I read a &lt;FONT color="#808080"&gt;uchar_t&lt;/FONT&gt; data type, I thought it was an &lt;B&gt;u&lt;/B&gt;nsigned &lt;B&gt;char t&lt;/B&gt;ype. But when I look it up on Definisions.hpp, I found out that it is:
&lt;PRE&gt;typedef unsigned short              uchar_t;        // 2-byte unicode charater (UTF16)&lt;/PRE&gt;
Why?????? This is so confusing.&lt;/BLOCKQUOTE&gt;
I'm not sure why this is confusing, but I assume you've not worked with any text encoding other than ASCII? Early text encodings of this type used only 1 byte (8 bits) per character, so the types char or unsigned char equated to a single character. However, this isn't suitable for many  languages that have far more than 256 characters.&lt;BR /&gt;
&lt;BR /&gt;
uchar_t is targeting UTF16, which is a 16 bit encoding and hence the unsigned short type. For more information about text encoding, take a look &lt;A href="http://www.unicode.org/standard/standard.html" target="_blank"&gt;here&lt;/A&gt;</description>
      <pubDate>Tue, 21 Oct 2014 21:51:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215731#M5358</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2014-10-21T21:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: uchar_t is confusing</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215732#M5359</link>
      <description>Well, when we are coding and we want to specify that a character is 16-bits, we use/define wchar / WCHAR (wide char, exactly 16-bits, based on wchar_t) or char16 / CHAR16 (at least 16-bits). We use uchar / UCHAR for unsigned char (and char / CHAR for signed char) for exactly 8-bits and char8 / CHAR8 for at least 8-bits.&lt;BR /&gt;
&lt;BR /&gt;
This is just a thought.</description>
      <pubDate>Tue, 11 Nov 2014 08:31:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215732#M5359</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2014-11-11T08:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: uchar_t is confusing</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215733#M5360</link>
      <description>&lt;BLOCKQUOTE&gt;ReignBough wrote:&lt;BR /&gt;Well, when we are coding and we want to specify that a character is 16-bits, we use/define wchar / WCHAR (wide char, exactly 16-bits, based on wchar_t) or char16 / CHAR16 (at least 16-bits). We use uchar / UCHAR for unsigned char (and char / CHAR for signed char) for exactly 8-bits and char8 / CHAR8 for at least 8-bits.&lt;/BLOCKQUOTE&gt;
None of these definitions are standards-based, so it's really a matter of semantics. You could also read uchar_t as &lt;B&gt;u&lt;/B&gt;nicode &lt;B&gt;char&lt;/B&gt;acter &lt;B&gt;t&lt;/B&gt;ype.&lt;BR /&gt;
&lt;BR /&gt;
It could also be argued that defining &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;wchar&lt;E&gt;&lt;/E&gt; as exactly 16 bits is confusing, given that the C++ standard defines &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;wchar_t&lt;E&gt;&lt;/E&gt; as the largest width for the locales supported by that implementation. Or defining &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;char16&lt;E&gt;&lt;/E&gt; as "at least 16 bits"  when the C++ standard for &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;char16_t&lt;E&gt;&lt;/E&gt; is exactly 16 bits.&lt;BR /&gt;
&lt;BR /&gt;
Horses for courses  &lt;E&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/E&gt;</description>
      <pubDate>Fri, 14 Nov 2014 14:10:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/uchar-t-is-confusing/m-p/215733#M5360</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2014-11-14T14:10:58Z</dc:date>
    </item>
  </channel>
</rss>

