{"id":1091,"date":"2022-08-30T15:12:14","date_gmt":"2022-08-30T15:12:14","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/difference-between-i-i-and-i-duplicate-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:12:14","modified_gmt":"2022-08-30T15:12:14","slug":"difference-between-i-i-and-i-duplicate-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/difference-between-i-i-and-i-duplicate-collection-of-common-programming-errors\/","title":{"rendered":"Difference between i = ++i and ++i [duplicate]-Collection of common programming errors"},"content":{"rendered":"<p>Writing <code>i = ++i;<\/code> writes to variable <code>i<\/code> twice (one for the increment, one for the assignment) without a sequence point between the two. This, according to the C language standard causes undefined behavior.<\/p>\n<p>This means the compiler is free to implement <code>i = ++i<\/code> as identical to <code>i = i + 1<\/code>, as <code>i = i + 2<\/code> (this actually makes sense in certain pipeline- and cache-related circumstances), or as <code>format C:\\<\/code> (silly, but technically allowed by the standard).<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:22:50. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Writing i = ++i; writes to variable i twice (one for the increment, one for the assignment) without a sequence point between the two. This, according to the C language standard causes undefined behavior. This means the compiler is free to implement i = ++i as identical to i = i + 1, as i [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1091","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1091","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1091"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1091\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1091"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}