{"id":800,"date":"2023-04-18T21:35:32","date_gmt":"2023-04-18T19:35:32","guid":{"rendered":"https:\/\/codevision.net.pl\/?p=800"},"modified":"2023-05-07T19:28:26","modified_gmt":"2023-05-07T17:28:26","slug":"beware-of-char-sign-and-unsigned-comparison-portable-code","status":"publish","type":"post","link":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/","title":{"rendered":"Beware of char and its traps"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Recently I was involved in testing of the API, which was working since years already, but required some refactoring for future use-cases. The API is used in the automotive ECU, powered by ARM processors. Nothing really special or difficult, but&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The API was using a data and its SHA-256 digest, both represented by <code>std::string<\/code>. Such an input was then validated internally by calculating the SHA-256 of data and comparing both hashes. Calculated hash was represented by <code>std::vector&lt;uint8_t><\/code>. Surprisingly, produced test cases were failing, even if the content was exactly the same!<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; gutter: false; highlight: [4]; notranslate\">\nstd::string user_input = &quot;\\x9f\\x68\\x12\\x0a&quot;;\nstd::vector&lt;uint8_t&gt; calculated_input {0x9f, 0x68, 0x12, 0x0a};\n\nassert(user_input.size() == calculated_input.size());\nassert(std::equal(std::begin(user_input), std::end(user_input), std::begin(calculated_input)));\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">As the API was surely working, my suspicions turned towards the test code. But after checking it dozen of times, I couldn&#8217;t find anything wrong. Suddenly I realized, that test code is compiled and executed in development enviromnent under x86, while the API is used in armv8 target. The <code>std::string<\/code> is storing and manipulating the sequence of character-like objects defined by character traits. Whether the underlying <code>char<\/code> (or its variant) type is signed or unsigned, depends on the platform and compiler. In most x86 GNU\/Linux and Microsoft systems the <code>char<\/code> type is signed. For ARM of PowerPC in turn, it is rather unsigned. The trace was confirmed, after running the test cases in the target.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So what really happened? When comparing the <code>std::string<\/code> with <code>std::vector&lt;uint8_t><\/code> content there is a comparison of (signed) <code>char<\/code> with <code>uint8_t<\/code> value. In such case the compiler converts signed value to unsigned and performs the comparison of unsigned values. If any value of individual character in <code>std::string<\/code> exceeds the range of <code>signed char<\/code> (here: 127 = 0x7F), then it is treated as negative value (overflow). During the comparison with <code>uint8_t<\/code> value it is casted to some huge unsigned number. In effect the <code>std::equal<\/code> fails with comparison.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; gutter: false; notranslate\">\nsigned char x = 127;\nstd::cout &lt;&lt; &quot;x = &quot; &lt;&lt; (int)x &lt;&lt; std::endl;           \/\/ x = 127\nsigned char y = 128;\nstd::cout &lt;&lt; &quot;y = &quot; &lt;&lt; (int)y &lt;&lt; std::endl;           \/\/ y = -128\nunsigned int z = y;\nstd::cout &lt;&lt; &quot;z = &quot; &lt;&lt; (unsigned int)z &lt;&lt; std::endl;  \/\/ z = 4294967168\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">How to fix the code and make it working, independent of the processor architecture? Seems that using a simple predicate solves the issue and quarantees that compared values have correct types:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; gutter: false; notranslate\">\nassert(std::equal(std::begin(user_input), std::end(user_input), std::begin(calculated_input), &#x5B;](uint8_t lhs, uint8_t rhs) { return lhs == rhs; }));\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>As a conclusion<\/strong>: beware of signed and unsigned value comparison, have in mind potential overflows and care about code portability.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I was involved in testing of the API, which was working since years already, but required some refactoring for future use-cases. The API is used in the automotive ECU, powered by ARM processors. Nothing really special or difficult, but&#8230; The API was using a data and its SHA-256 digest, both represented by std::string. Such [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[17,16],"tags":[22,8,7],"class_list":["post-800","post","type-post","status-publish","format-standard","hentry","category-c","category-development","tag-c-2","tag-development","tag-software"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.6.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"p.stanisz\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.6.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"CodeVision - Software Development and Architecture\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Beware of char and its traps - portability, signedness and more\" \/>\n\t\t<meta property=\"og:description\" content=\"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/codevision.net.pl\/wp-content\/uploads\/2023\/02\/cropped-logo-nobackground-200.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/codevision.net.pl\/wp-content\/uploads\/2023\/02\/cropped-logo-nobackground-200.png\" \/>\n\t\t<meta property=\"og:image:width\" content=\"200\" \/>\n\t\t<meta property=\"og:image:height\" content=\"128\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2023-04-18T19:35:32+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2023-05-07T17:28:26+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Beware of char and its traps - portability, signedness and more\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/codevision.net.pl\/wp-content\/uploads\/2023\/02\/cropped-logo-nobackground-200.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#blogposting\",\"name\":\"Beware of char and its traps - portability, signedness and more\",\"headline\":\"Beware of char and its traps\",\"author\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/author\\\/admin3262\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/codevision.net.pl\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/codevision-logo-light.png\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/#articleImage\",\"width\":480,\"height\":271,\"caption\":\"CodeVision\"},\"datePublished\":\"2023-04-18T21:35:32+02:00\",\"dateModified\":\"2023-05-07T19:28:26+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#webpage\"},\"articleSection\":\"C++, Development, c++, development, software\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/codevision.net.pl\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/category\\\/development\\\/#listItem\",\"name\":\"Development\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/category\\\/development\\\/#listItem\",\"position\":2,\"name\":\"Development\",\"item\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/category\\\/development\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/category\\\/development\\\/c\\\/#listItem\",\"name\":\"C++\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/category\\\/development\\\/c\\\/#listItem\",\"position\":3,\"name\":\"C++\",\"item\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/category\\\/development\\\/c\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#listItem\",\"name\":\"Beware of char and its traps\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/category\\\/development\\\/#listItem\",\"name\":\"Development\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#listItem\",\"position\":4,\"name\":\"Beware of char and its traps\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/category\\\/development\\\/c\\\/#listItem\",\"name\":\"C++\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/#organization\",\"name\":\"CodeVision\",\"description\":\"Software Development and Architecture\",\"url\":\"https:\\\/\\\/codevision.net.pl\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/codevision.net.pl\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/codevision-logo-light.png\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#organizationLogo\",\"width\":480,\"height\":271,\"caption\":\"CodeVision\"},\"image\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/author\\\/admin3262\\\/#author\",\"url\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/author\\\/admin3262\\\/\",\"name\":\"p.stanisz\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1fd7bd51cf24919cd9c148ae2e6caa09af580e7d304cc019e95ac5e478f7c29d?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"p.stanisz\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#webpage\",\"url\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/\",\"name\":\"Beware of char and its traps - portability, signedness and more\",\"description\":\"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/2023\\\/04\\\/18\\\/beware-of-char-sign-and-unsigned-comparison-portable-code\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/author\\\/admin3262\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/index.php\\\/author\\\/admin3262\\\/#author\"},\"datePublished\":\"2023-04-18T21:35:32+02:00\",\"dateModified\":\"2023-05-07T19:28:26+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/#website\",\"url\":\"https:\\\/\\\/codevision.net.pl\\\/\",\"name\":\"CodeVision\",\"description\":\"Software Development and Architecture\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/codevision.net.pl\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Beware of char and its traps - portability, signedness and more","description":"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.","canonical_url":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#blogposting","name":"Beware of char and its traps - portability, signedness and more","headline":"Beware of char and its traps","author":{"@id":"https:\/\/codevision.net.pl\/index.php\/author\/admin3262\/#author"},"publisher":{"@id":"https:\/\/codevision.net.pl\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/codevision.net.pl\/wp-content\/uploads\/2026\/11\/codevision-logo-light.png","@id":"https:\/\/codevision.net.pl\/#articleImage","width":480,"height":271,"caption":"CodeVision"},"datePublished":"2023-04-18T21:35:32+02:00","dateModified":"2023-05-07T19:28:26+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#webpage"},"isPartOf":{"@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#webpage"},"articleSection":"C++, Development, c++, development, software"},{"@type":"BreadcrumbList","@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/#listItem","position":1,"name":"Home","item":"https:\/\/codevision.net.pl\/","nextItem":{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/index.php\/category\/development\/#listItem","name":"Development"}},{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/index.php\/category\/development\/#listItem","position":2,"name":"Development","item":"https:\/\/codevision.net.pl\/index.php\/category\/development\/","nextItem":{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/index.php\/category\/development\/c\/#listItem","name":"C++"},"previousItem":{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/index.php\/category\/development\/c\/#listItem","position":3,"name":"C++","item":"https:\/\/codevision.net.pl\/index.php\/category\/development\/c\/","nextItem":{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#listItem","name":"Beware of char and its traps"},"previousItem":{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/index.php\/category\/development\/#listItem","name":"Development"}},{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#listItem","position":4,"name":"Beware of char and its traps","previousItem":{"@type":"ListItem","@id":"https:\/\/codevision.net.pl\/index.php\/category\/development\/c\/#listItem","name":"C++"}}]},{"@type":"Organization","@id":"https:\/\/codevision.net.pl\/#organization","name":"CodeVision","description":"Software Development and Architecture","url":"https:\/\/codevision.net.pl\/","logo":{"@type":"ImageObject","url":"https:\/\/codevision.net.pl\/wp-content\/uploads\/2026\/11\/codevision-logo-light.png","@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#organizationLogo","width":480,"height":271,"caption":"CodeVision"},"image":{"@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/codevision.net.pl\/index.php\/author\/admin3262\/#author","url":"https:\/\/codevision.net.pl\/index.php\/author\/admin3262\/","name":"p.stanisz","image":{"@type":"ImageObject","@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/1fd7bd51cf24919cd9c148ae2e6caa09af580e7d304cc019e95ac5e478f7c29d?s=96&d=mm&r=g","width":96,"height":96,"caption":"p.stanisz"}},{"@type":"WebPage","@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#webpage","url":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/","name":"Beware of char and its traps - portability, signedness and more","description":"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/codevision.net.pl\/#website"},"breadcrumb":{"@id":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/#breadcrumblist"},"author":{"@id":"https:\/\/codevision.net.pl\/index.php\/author\/admin3262\/#author"},"creator":{"@id":"https:\/\/codevision.net.pl\/index.php\/author\/admin3262\/#author"},"datePublished":"2023-04-18T21:35:32+02:00","dateModified":"2023-05-07T19:28:26+02:00"},{"@type":"WebSite","@id":"https:\/\/codevision.net.pl\/#website","url":"https:\/\/codevision.net.pl\/","name":"CodeVision","description":"Software Development and Architecture","inLanguage":"en-US","publisher":{"@id":"https:\/\/codevision.net.pl\/#organization"}}]},"og:locale":"en_US","og:site_name":"CodeVision - Software Development and Architecture","og:type":"article","og:title":"Beware of char and its traps - portability, signedness and more","og:description":"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.","og:url":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/","og:image":"https:\/\/codevision.net.pl\/wp-content\/uploads\/2023\/02\/cropped-logo-nobackground-200.png","og:image:secure_url":"https:\/\/codevision.net.pl\/wp-content\/uploads\/2023\/02\/cropped-logo-nobackground-200.png","og:image:width":200,"og:image:height":128,"article:published_time":"2023-04-18T19:35:32+00:00","article:modified_time":"2023-05-07T17:28:26+00:00","twitter:card":"summary_large_image","twitter:title":"Beware of char and its traps - portability, signedness and more","twitter:description":"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.","twitter:image":"https:\/\/codevision.net.pl\/wp-content\/uploads\/2023\/02\/cropped-logo-nobackground-200.png"},"aioseo_meta_data":{"post_id":"800","title":"#post_title #separator_sa portability, signedness and more","description":"Problems with char type under different processor architectures. Signed and unsigned comparison, overflow detection and portable code.","keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-08-07 13:13:12","updated":"2026-11-03 13:41:51","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/codevision.net.pl\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/codevision.net.pl\/index.php\/category\/development\/\" title=\"Development\">Development<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/codevision.net.pl\/index.php\/category\/development\/c\/\" title=\"C++\">C++<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tBeware of char and its traps\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/codevision.net.pl\/"},{"label":"Development","link":"https:\/\/codevision.net.pl\/index.php\/category\/development\/"},{"label":"C++","link":"https:\/\/codevision.net.pl\/index.php\/category\/development\/c\/"},{"label":"Beware of char and its traps","link":"https:\/\/codevision.net.pl\/index.php\/2023\/04\/18\/beware-of-char-sign-and-unsigned-comparison-portable-code\/"}],"_links":{"self":[{"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/800","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/comments?post=800"}],"version-history":[{"count":5,"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/800\/revisions"}],"predecessor-version":[{"id":835,"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/800\/revisions\/835"}],"wp:attachment":[{"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/media?parent=800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/categories?post=800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codevision.net.pl\/index.php\/wp-json\/wp\/v2\/tags?post=800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}