{"id":1803,"date":"2023-10-24T18:12:01","date_gmt":"2023-10-24T16:12:01","guid":{"rendered":"https:\/\/foton.szikraistvan.hu\/blog\/?p=1803"},"modified":"2023-10-24T18:12:07","modified_gmt":"2023-10-24T16:12:07","slug":"naming-variables-and-arguments","status":"publish","type":"post","link":"https:\/\/foton.szikraistvan.hu\/blog\/?p=1803","title":{"rendered":"Naming variables and arguments"},"content":{"rendered":"\n<p>I rewatched recently a C++ conference video: <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"584\" height=\"329\" src=\"https:\/\/www.youtube.com\/embed\/kYVxGyido9g?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span>\n<\/div><figcaption>CppCon 2018: Kate Gregory \u201cWhat Do We Mean When We Say Nothing At All?\u201d<\/figcaption><\/figure>\n\n\n\n<p>Then I did some research and posted a comment which YouTube decided to remove because it detected &#8220;Spam, deceptive practices, &amp; scams policies&#8221; violation.It didn&#8217;t provide any detail, or a way to check what the comment was or appeal the removal. Nice!  I was only able to find out which comment it was by looking at my <a href=\"https:\/\/www.youtube.com\/feed\/history\/comment_history\" data-type=\"URL\" data-id=\"https:\/\/www.youtube.com\/feed\/history\/comment_history\">Your YouTube Comments<\/a> history and see which comment was NOT there (you have to rely on your memory, because there is no mark that a comment was deleted, or when, on which video&#8230;). I will try to reproduce it from  memory here (because I cannot find it anywhere), I&#8217;ll let the reader decide it it was spam, scam or not:<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>It&#8217; not enough to name your arguments, the <strong>name<\/strong>s have to be <strong>meaningful<\/strong>.<br \/>In 2023 we still have this:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>const <\/strong>char * strstr ( const char * str1, const char * str2 ); <br \/>thanks <a href=\"https:\/\/cplusplus.com\/reference\/cstring\/strstr\/\" data-type=\"URL\" data-id=\"https:\/\/cplusplus.com\/reference\/cstring\/strstr\/\">cplusplus.com<\/a> ! WTF is str1 and str2? And this is the 1st result on Google (I mean <a href=\"https:\/\/duckduckgo.com\/?q=strstr&amp;ia=web\" data-type=\"URL\" data-id=\"https:\/\/duckduckgo.com\/?q=strstr&amp;ia=web\">duckduckgo.com<\/a>)<\/li><li>char *strstr(const char *haystack, const char *needle) <a href=\"https:\/\/www.tutorialspoint.com\/c_standard_library\/c_function_strstr.htm\" data-type=\"URL\" data-id=\"https:\/\/www.tutorialspoint.com\/c_standard_library\/c_function_strstr.htm\">tutorialspoint.com<\/a> has it right<\/li><li>char *strstr(const char *str,const char *strSearch);    so does <a href=\"https:\/\/learn.microsoft.com\/en-us\/cpp\/c-runtime-library\/reference\/strstr-wcsstr-mbsstr-mbsstr-l?view=msvc-170\" data-type=\"URL\" data-id=\"https:\/\/learn.microsoft.com\/en-us\/cpp\/c-runtime-library\/reference\/strstr-wcsstr-mbsstr-mbsstr-l?view=msvc-170\">learn.microsoft.com<\/a><\/li><li>char *strstr (const char *s1, const char *s2);              <a href=\"https:\/\/www.geeksforgeeks.org\/strstr-in-ccpp\/\">geeksforgeeks.org<\/a> can F*** right off<\/li><li>char *strstr( const char *str, const char *substr );       <a href=\"https:\/\/en.cppreference.com\/w\/c\/string\/byte\/strstr\">cppreference.com<\/a> does it well<\/li><li>char *strstr(const char *string1, const char *string2); <a href=\"https:\/\/www.ibm.com\/docs\/en\/i\/7.4?topic=functions-strstr-locate-substring\">IBM <\/a>can also go to hell<\/li><li>char *strstr(const char *s1, const char *s2);               so do <a href=\"https:\/\/pubs.opengroup.org\/\" data-type=\"URL\" data-id=\"https:\/\/pubs.opengroup.org\/\">pubs.opengroup.org<\/a><\/li><\/ul>\n\n\n\n<p>Yay, at least they all name the arguments. Are we happy now?<br \/>Well, actually not all, this is what newlib has to say about this:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>char *_EXFUN(strstr,(const char *, const char *)); <sup><a href=\"#strstr_footnote1\" data-type=\"internal\" data-id=\"#strstr_footnote1\">1<\/a><\/sup> or<\/li><li>char *strstr (const char *, const char *); <sup><a href=\"#strstr_footnote2\" data-type=\"internal\" data-id=\"#strstr_footnote2\">2<\/a><\/sup><\/li><\/ul>\n\n\n\n<p>Good luck to my fellow embedded developers!<\/p>\n\n\n\n<p>How are junior programmers supposed to name arguments right when this is what they learn from the big guys?<\/p>\n\n\n\n<p>And contrary to what cplusplus.com says, strstr returns a NON const pointer from 2 const pointer. Congratulation!<\/p>\n\n\n\n<p>We are all doomed!<\/p>\n\n\n\n<p>[<a id=\"strstr_footnote1\">1<\/a>] <a href=\"https:\/\/github.com\/eblot\/newlib\/blob\/master\/newlib\/libc\/include\/string.h\">github.com\/eblot\/newlib\/blob\/master\/newlib\/libc\/include\/string.h<\/a><br \/><a href=\"https:\/\/github.com\/32bitmicro\/newlib-nano-1.0\/blob\/master\/newlib\/libc\/include\/string.h\">github.com\/32bitmicro\/newlib-nano-1.0\/blob\/master\/newlib\/libc\/include\/string.h<\/a>\n<br \/>[<a id=\"strstr_footnote2\">2<\/a>] <a href=\"https:\/\/sourceware.org\/git\/?p=newlib-cygwin.git;a=blob;f=newlib\/libc\/include\/string.h;h=32199c027ae0ba4a68884f458065287058193dd2;hb=9e09d6ed83cce4777a5950412647ccc603040409\" data-type=\"URL\" data-id=\"https:\/\/sourceware.org\/git\/?p=newlib-cygwin.git;a=blob;f=newlib\/libc\/include\/string.h;h=32199c027ae0ba4a68884f458065287058193dd2;hb=9e09d6ed83cce4777a5950412647ccc603040409\">sourceware.org<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>&#8230; and I understand why YouTYube might detect the &#8220;excessive&#8221; domain name usage and a couple of links as spam, but FUCK them too for removing my educational comment without providing: 1\/ any means to see the comment they have an issue with; 2\/ recover a copy; 3\/ appeal to restore it&#8230; Meanwhile leaving trash comment up and letting actual scams trough!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I rewatched recently a C++ conference video: Then I did some research and posted a comment which YouTube decided to remove because it detected &#8220;Spam, deceptive practices, &amp; scams policies&#8221; violation.It didn&#8217;t provide any detail, or a way to check &hellip; <a href=\"https:\/\/foton.szikraistvan.hu\/blog\/?p=1803\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[32],"tags":[185,135],"class_list":["post-1803","post","type-post","status-publish","format-standard","hentry","category-cooding","tag-c-2","tag-c"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3E7AZ-t5","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1803"}],"version-history":[{"count":1,"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1803\/revisions"}],"predecessor-version":[{"id":1804,"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1803\/revisions\/1804"}],"wp:attachment":[{"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/foton.szikraistvan.hu\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}