{"id":133,"date":"2014-12-20T01:19:12","date_gmt":"2014-12-20T01:19:12","guid":{"rendered":"http:\/\/www.troliver.com\/?p=133"},"modified":"2015-01-06T15:24:53","modified_gmt":"2015-01-06T15:24:53","slug":"using-characters-malloc-memcpy-and-compiling-in-c-in-visual-studio-aka-weird-stuff-that-can-happen-when-adding-strings","status":"publish","type":"post","link":"https:\/\/www.troliver.com\/?p=133","title":{"rendered":"Using characters, malloc, memcpy and compiling in C in Visual Studio (aka weird stuff that can happen when adding strings)"},"content":{"rendered":"<p><em>(I am trying out a new theme today called <a href=\"https:\/\/wordpress.org\/plugins\/crayon-syntax-highlighter\/\">Crayon syntax highlighter <\/a>which should hopefully make some of these coding examples I do look a bit prettier. I set it to the Visual Studio 2012 theme, which means using Consolas as the font. So lets see how this goes!)<\/em><\/p>\n<p>Today I will show you what happens when you do something totally logical but, actually, not in the correct way (and arguably <a href=\"http:\/\/stackoverflow.com\/questions\/605845\/do-i-cast-the-result-of-malloc\">not even a way in which you should do it at all<\/a>, but we will have to ignore that for now). First of all, some background; in an attempt to add together some strings of an undetermined length, I created a function which did some very bizarre things. I will go through some background of using characters and lead onto what happened. So as a really basic example, we can just make a new\u00a0C++ console project in Visual Studio and do the following in a main .cpp;<\/p>\n<h2><strong>Characters<\/strong><\/h2>\n<pre class=\"lang:c++ decode:true\">#include \"stdafx.h\"\r\nint _tmain(int argc, _TCHAR* argv[])\r\n{\r\n\tfirstname = \"Arseniy \";\r\n\tsurname = \"Yatsenyuk\";\r\n\r\n\taddstrings(&amp;name, firstname, surname);\r\n\treturn 0;\r\n}\r\n<\/pre>\n<p>We basically have two strings of text that represent a first name and a surname (I was going to choose Putin but I decided that Yatsenyuk is a good guy at this point in time and I feel quite positive writing this).<\/p>\n<p>Important note here: a string is an array of ascii characters. Each character is one byte and can be anywhere from 0 to 255 in value. Actually, it is an array of characters, terminated with a null termination character. This means we just fill up a character, or an array of characters, with numbers that correspond to text (or escape characters, such as the termination character).<\/p>\n<p>Oh yeah, we need to add three strings too, so if we declare them outside of the main function, we can use them everywhere in our program;<\/p>\n<pre class=\"lang:c++ decode:true\">char * name;\r\nchar * firstname;\r\nchar * surname;\r\n<\/pre>\n<p>So what we do here is to declare three character pointers. Which can represent a string.\u00a0What does this do? It allocates a\u00a0<em>pointer to a memory location<\/em>\u00a0that will represent a character (which is a single byte of data). Why is this important? Because this post relies on using memory addresses quite a lot and understanding how pointers work is really important in this basic example. Or rather, this basic example should be able to demonstrate using pointers a bit more.<\/p>\n<p>If we then look back at what we are doing by giving a value to &#8220;firstname&#8221;, we are actually not giving it a single value (which would be written using a single-quote, for example &#8216;a&#8217; or &#8216;H&#8217;) but a <strong>string of values<\/strong>.<\/p>\n<p>What this statement does is to create a new array of characters, of the correct length (plus one, actually, as it will add a null-termination character onto the end of the array &#8211; which is a &#8216;\\0&#8217;. The length, therefore, is going to be one character more than you would think it should be!). It does this by assigning some new memory to an array of characters and, because the variable &#8220;firstname&#8221; is a pointer, what we <em>actually<\/em>\u00a0get back is just that &#8211; a pointer to the memory location where this new array of characters is stored. So &#8220;firstname&#8221; does not store any text; it stores the memory address of where the character array actually resides in memory.<\/p>\n<p>So (firstname = &#8220;Arseniy &#8220;) is an initialisation function, returning the address of &#8220;A&#8221; as its result. To access any letter, we can just say &#8220;firstname[3]&#8221; to access the &#8220;e&#8221; &#8211; or we can say &#8220;firstname + 3&#8221;.<\/p>\n<p>Now hold up a minute, you may rightly say. Adding to an array, what?! Well that would be wrong entirely; you are not adding to an array, because &#8220;firstname&#8221; is not an array. It is a <em>pointer to a location in memory.\u00a0<\/em>So what you actually are doing, is referring to a place in memory\u00a0that is three values higher than &#8220;firstname&#8221;. Which is exactly what &#8220;firstname[3]&#8221; refers to, as well. But if we use this memory address, we will receive the value stored there; which is &#8220;e&#8221;.<\/p>\n<p>Alternatively we could initialise both of these as arrays in the first place.<\/p>\n<pre class=\"lang:default decode:true\">char firstname[] = \"Arseniy \"\r\nchar surname[16] = \"Yatsenyuk\"<\/pre>\n<p>These are analogous to doing the following:<\/p>\n<pre class=\"lang:default decode:true\">char firstname[9] = {'A', 'r', 's', 'e', 'n', 'i', 'y', ' ', '\\0'};\r\nchar surname[16] = {'Y', 'a', 't', 's', 'e', 'n', 'y', ' u ', 'k', 0, 0, 0, 0, 0, 0, 0 };<\/pre>\n<p>There is a difference here, which is that when we specify an array size ourselves, assigning the string to it will not terminate it (and the rest of the values are 0s). However, if we give the array no size, it will be sized as the length of the string we give it plus one (for the termination character). Sometimes we might not want the termination character &#8211; indeed, when you are combining strings, you might not want to include this character too!<\/p>\n<p>However, we don&#8217;t know necessarily what we are going to do with the character arrays; especially in the case of &#8220;name&#8221;, which will combine the two. We won&#8217;t know until runtime how big this will be so we have to use pointers in order to allocate memory on the <i>heap<\/i>. This is memory for dynamically allocated resources and, because we have no idea what memory we will necessarily be given at runtime (and it changes depending on system availability), we need to use pointers to store the memory as it is allocated.<\/p>\n<p>(It is worth noting that passing arrays of characters as parameters in functions will pass them\u00a0<em>by reference<\/em> by default. This is important to note, because any changes you make within that function will affect the original data being passed in; so to prevent against this, we will specify the signature as being const char * rather than simply char*. What actually will get passed is not the array but the <em>pointer<\/em> to the first address of the array &#8211; even if an array size is specified in the function signature, it is just ignored)<\/p>\n<h2>The function<\/h2>\n<p>Ok so now we have our character pointers made, let&#8217;s look at that actual &#8220;addstrings&#8221; function. Warning: anyone who really really knows C or C++ will hate how I have written this.<\/p>\n<pre class=\"lang:default decode:true\">void addstrings(char ** result, char * firstpart, char * secondpart)\r\n{\r\n\tint x = strlen(firstpart);\r\n\tint y = strlen(secondpart);\r\n\r\n\t*result = (char *)malloc((x + y + 1) * sizeof(char));\r\n\r\n\tmemcpy(*result,\t\t\tfirstpart,\t\tx);\r\n\tmemcpy(*result + x,\t\tsecondpart,\t\ty);\r\n\r\n\t*result[x + y] = '\\0';\r\n}\r\n<\/pre>\n<p>What we do here is:<\/p>\n<ul>\n<li>Take a pointer to a character pointer (a pointer to a pointer, yes)<\/li>\n<li>Take a pointer to a character, twice<\/li>\n<li>Calculate the length of those two character pointers<\/li>\n<li>Assign a new memory address to the\u00a0<strong>dereferenced<\/strong> pointer which is what we are \u00a0going to be using to store our final string in<\/li>\n<li>Copy the contents of the first character pointer into this new memory address for its entire length<\/li>\n<li>Copy the contents of the second character pointer as well, but starting from the address of the first one&#8217;s length, otherwise we just overwrite what we already put into the new pointer.<\/li>\n<li>Finally, we add a null terminating character onto the end<\/li>\n<\/ul>\n<p>So it isn&#8217;t terribly complex if you can just remember that all a pointer is is a 4 byte piece of data that contains an address of memory where some data resides. Then, when working with pointers, we can copy addresses and contents of addresses over.<\/p>\n<h3>Pointers to pointers<\/h3>\n<p>Let&#8217;s break this down a bit further. The first thing we have is our &#8220;double&#8221; pointer. The reason for this is because we have no pointer &#8211; I mean, the pointer we call\u00a0&#8220;name&#8221; has not been initialised. It has an address of 0 &#8211; that is, it has no address at all. It is just nothing. So we want to initialise it. We can&#8217;t just pass it as we do the other strings &#8211; because they have been initialised with a memory address. So we have to pass a reference to the pointer (which is done with the ampersand symbol), which translates as a pointer to a pointer.<\/p>\n<h3>Dereferencing<\/h3>\n<p>Now we want to dereference it. This means that, when we modify this reference, we want to modify the data that the reference points to (just like a pointer because.. well.. it is). In this case, we have to say &#8221; *result &#8221; &#8211; the asterisk as a prefix now acts as a dereferencing operator. So, instead of the memory address of the passed-in reference, we have access to the memory address of the actual pointer.. which is 0.<\/p>\n<h3>Malloc<\/h3>\n<p>But that is fine, because we are going to give it a value. And this value is the memory address of a brand new set of data &#8211; totally empty, of course, but enough to support the length of the first set of characters, the second set of characters plus a terminating character we will manually add (so x, y and 1). These numbers added together will tell malloc how many\u00a0<em>bytes<\/em> to allocate; so if we were doing an allocation of ints, we would need that many ints multiplied by how many bytes an int represents. This is why I added sizeof(char) &#8211; it still represents 1, but it emphasises that you would use sizeof() to get the length of a datatype (note that if you were to do sizeof on an array, it will return the size of the array and not the length of a string of characters, which could be much shorter).<\/p>\n<p>It is at this point that I should point out a difference between C and C++.<\/p>\n<p>In C, you don&#8217;t actually need to convert the pointer that is returned by malloc into a char. Malloc will do this anyway. I personally liked to do this to get exactly what I want\u00a0<a href=\"http:\/\/stackoverflow.com\/questions\/605845\/do-i-cast-the-result-of-malloc\">but apparently this is just something that people don&#8217;t like to see<\/a>. But ignoring all of the supposed repetition and clutter you get from just adding the casting from a void pointer to a character pointer (and really, a pointer is a pointer.. the only thing the data type does is to signify how big an element is that the pointer points to), there is a genuine concern. It turns out malloc returns an int &#8211; but if you include stdlib.h, malloc apparently will convert whatever you are asking it to make into where you are trying to store it. If you explicitly cast it to (char *), you won&#8217;t receive an error that would relate to stdlib not being included &#8211; because you are doing what the malloc definition in stdlib would have done.<\/p>\n<p>Lets try this out and take out the implicit cast and also take out using stdlib and see what happens:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-140 size-full\" src=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/mallocerror.png\" alt=\"mallocerror\" width=\"336\" height=\"145\" srcset=\"https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/mallocerror.png 336w, https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/mallocerror-300x129.png 300w\" sizes=\"(max-width: 336px) 100vw, 336px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Ok so the first problem is that malloc isn&#8217;t even found. Hmm. Lets add stdlib.h back in and see what happens.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-141 size-full\" src=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/mallocerror2.png\" alt=\"mallocerror2\" width=\"406\" height=\"23\" srcset=\"https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/mallocerror2.png 406w, https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/mallocerror2-300x17.png 300w\" sizes=\"(max-width: 406px) 100vw, 406px\" \/><\/p>\n<p>An error, still? I thought we can do implicit conversion! But wait &#8211; we are still using the C++ compiler&#8230;<\/p>\n<p>Compiling using C<\/p>\n<p>Here we go. How to compile using C++ in Visual Studio. Under the project properties, we can go to the\u00a0<strong>Advanced<\/strong> properties under C\/C++. Here we can actually tell it to just use the C compiler<\/p>\n<p><a href=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/compile-as-C.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-142 size-medium\" src=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/compile-as-C-258x300.png\" alt=\"compile as C\" width=\"258\" height=\"300\" srcset=\"https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/compile-as-C-258x300.png 258w, https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/compile-as-C.png 766w\" sizes=\"(max-width: 258px) 100vw, 258px\" \/><\/a><\/p>\n<p>And now the errors go away if we include stdlib.h, regardless of whether or not we add (char *) before malloc to convert the pointer to a char* pointer. So lets go back and get rid of stdlib.h:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-143\" src=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/stdlib.png\" alt=\"stdlib\" width=\"446\" height=\"283\" srcset=\"https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/stdlib.png 446w, https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/stdlib-300x190.png 300w\" sizes=\"(max-width: 446px) 100vw, 446px\" \/><\/p>\n<p>In the first instance, we will get two warnings, but if we add a (char *) conversion, we only get one. Interestingly, we only get warnings and furthermore, we are warned that malloc isn&#8217;t defined in either case. But in neither case are we warned about not having stdlib.h included. Perhaps this is related to Microsoft&#8217;s C compiler that ships with Visual Studio 2013 SP4 &#8211; but it shows how you can actually specify to use the C compiler instead of C++.<\/p>\n<p>Secondly, it is probably worth mentioning that malloc isn&#8217;t favoured to be used in C++. One difference is that if you want to deallocate memory allocated by malloc, you have to use free() &#8211; in C++, you would use the &#8220;new&#8221; and &#8220;delete&#8221; keywords. You can still use malloc, but the std library has functions for handling strings so there isn&#8217;t really a reason not to use this instead, except in the case where you might use a string that isn&#8217;t a string (u_char isn&#8217;t considered a string..). Additionally, malloc simply assigns memory and memcpy copies memory but C++&#8217;s\u00a0<strong>new<\/strong>\u00a0operator will call a constructor. C++&#8217;s object-oriented functionality like this is useful and we can say we want a <em>new string <\/em>if we want to do the above.\u00a0So there are some important\u00a0differences here to be aware of but really if you use C then there is no reason not to just use malloc without a conversion and if you use C++ then you\u00a0can just use &#8220;string&#8221; types instead.<\/p>\n<p>Anyhow, onto what happens with the code for a final, interesting, look at a problem!<\/p>\n<h2>The problem<\/h2>\n<p>Ok, so if we take this code and run it as we have made it above, it should work.<\/p>\n<pre class=\"lang:c++ decode:true\">#include \"stdafx.h\"\r\n#include &lt;stdlib.h&gt;\r\n#include &lt;string.h&gt;\r\n\r\nchar * name;\r\nchar * firstname;\r\nchar * surname;\r\n\r\nvoid addstrings(char ** result, char * firstpart, char * secondpart)\r\n{\r\n\tint x = strlen(firstpart);\r\n\tint y = strlen(secondpart);\r\n\r\n\r\n\t*result = (char *) malloc((x + y + 1) * sizeof(char));\r\n\r\n\tmemcpy(*result,\t\tfirstpart,\tx);\r\n\tmemcpy(*result + x, secondpart, y);\r\n\t  \r\n\t*result[x + y] = '\\0';\r\n}\r\n\r\n\r\n\r\nint _tmain(int argc, _TCHAR* argv[])\r\n{\r\n\tfirstname = \"Arseniy \";\r\n\tsurname = \"Yatsenyuk\";\r\n\r\n\taddstrings(&amp;name, firstname, surname);\r\n\treturn 0;\r\n}<\/pre>\n<p>The problem is, is that you get an exception trying to write to memory address 0 when trying to set this line:<\/p>\n<pre class=\"lang:c++ decode:true\">*result[x + y] = '\\0';<\/pre>\n<p>Everything should work fine. Bizarrely, it doesn&#8217;t. Everywhere we have dereferenced &#8220;result&#8221; has worked fine &#8211; even examining the variables shows that result points to a pointer that contains the text we want. But we can&#8217;t seem to set anything.<\/p>\n<p><a href=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p1.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-full wp-image-144 aligncenter\" src=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p1.png\" alt=\"p1\" width=\"721\" height=\"414\" srcset=\"https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p1.png 721w, https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p1-300x172.png 300w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><\/a><\/p>\n<p>This had me going mental for absolutely ages. It made no sense as to what was going on. However, the first hint as to what it could be came when I just changed the array index that I was trying to alter. If I set it to 0, it cleared the value of result (and, subsequently, the global variable it pointed to). If I set it to 1, something surprising happened.<\/p>\n<p><a href=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p2.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-full wp-image-145 aligncenter\" src=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p2.png\" alt=\"p2\" width=\"537\" height=\"275\" srcset=\"https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p2.png 537w, https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p2-300x154.png 300w\" sizes=\"(max-width: 537px) 100vw, 537px\" \/><\/a><\/p>\n<p>Still an error, but the address was no longer 0x00000000. On inspection, it turns out that the memory address of position 1 corresponds to the memory address of &#8220;firstpart&#8221; (which is &#8220;firstname&#8221;). Sure enough, position 2 of the array corresponds to the memory address of &#8220;secondpart&#8221;.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p3.png\"><img decoding=\"async\" loading=\"lazy\" class=\" size-full wp-image-146 aligncenter\" src=\"http:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p3.png\" alt=\"p3\" width=\"634\" height=\"423\" srcset=\"https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p3.png 634w, https:\/\/www.troliver.com\/wp-content\/uploads\/2014\/12\/p3-300x200.png 300w\" sizes=\"(max-width: 634px) 100vw, 634px\" \/><\/a><\/p>\n<p>In fact, setting result[2] to &#8216;\\0&#8217;, without the dereference, will wipe the secondpart pointer entirely (this is exactly why const char pointers are important, to avoid accidentally doing what I just did here!). So what exactly is *result[2] doing?<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/27572887\/error-with-assigning-a-value-to-an-element-of-an-array-of-characters-once-initia\">It turns out <\/a>that this is to do with the order in which the statement is evaluated. All along, the assumption has been that these two statements were the same thing:<\/p>\n<pre class=\"lang:c++ decode:true\">*result[x + y] = '\\0';\t\r\n(* result) [x + y] = '\\0'<\/pre>\n<p>&nbsp;<\/p>\n<p>When actually, the following is the case:<\/p>\n<pre class=\"lang:c++ decode:true\">*(result[x + y]) = '\\0';<\/pre>\n<p>&nbsp;<\/p>\n<p>And what this means is that, all along, we have been de-referencing whatever is located at each part of the pointer reference. The only valid thing to do this to would be results[0] &#8211; as this is a pointer to a pointer; but results[1] is a pointer which\u00a0is already dereferenced. What we actually wanted to do, was to dereference the pointer-pointer first and\u00a0<em>then<\/em> access a location relative to that.<\/p>\n<h2>The lesson is:<\/h2>\n<p>It turns out that<\/p>\n<pre class=\"lang:c++ decode:true\">*result[x + y] = '\\0';<\/pre>\n<p>Is actually saying:<\/p>\n<pre class=\"lang:c++ decode:true \">* (result[x + y]) = '\\0';<\/pre>\n<p>And therefore, I have to explicitly state:<\/p>\n<pre class=\"lang:c++ decode:true \">(* result) [x + y] = '\\0';<\/pre>\n<p><em><strong>Array notation takes precedence over dereferencing.<\/strong><\/em><\/p>\n<p>And there you have it. If this ever happens to you, make sure that you use brackets to contain whatever you are trying to say or do in this way. If anyone has any questions or issues with the code and\u00a0statements above, feel free to leave them in a comment below!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(I am trying out a new theme today called Crayon syntax highlighter which should hopefully make some of these coding examples I do look a bit prettier. I set it to the Visual Studio 2012 theme, which means using Consolas as the font. So lets see how this goes!) Today I will show you what [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[21],"tags":[30,31,32,33,34],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6PQZ3-29","_links":{"self":[{"href":"https:\/\/www.troliver.com\/index.php?rest_route=\/wp\/v2\/posts\/133"}],"collection":[{"href":"https:\/\/www.troliver.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.troliver.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.troliver.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.troliver.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=133"}],"version-history":[{"count":7,"href":"https:\/\/www.troliver.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/www.troliver.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/www.troliver.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.troliver.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.troliver.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}