{"id":2439,"date":"2022-08-30T15:24:52","date_gmt":"2022-08-30T15:24:52","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/12\/problem-about-undef-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:24:52","modified_gmt":"2022-08-30T15:24:52","slug":"problem-about-undef-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-undef-collection-of-common-programming-errors\/","title":{"rendered":"problem about undef-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li>\n<img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/IRrox.jpg?s=32&amp;g=1\" \/><br \/>\nmattk<br \/>\nerlang undef cowboy<br \/>\nI am trying to run a custom application but get multiple errors. I believe the main egs app gets an error because it calls the egs patch app which has an undefined type. I cant figure out how to get this working I have tried recompiling the code many times in regards to others with a similar problem but nothing seems to work. The cowboy start listener remains undefined.This is the error I receive.=CRASH REPORT==== 10-Apr-2013::21:02:00 ===crasher:initial call: application_master:init\/4pid: &lt;0<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/68c0567b3dcd0eb91b7b0835b22a9210?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nKenB<br \/>\nc preprocessor define undef<br \/>\nSo, to start off, here&#8217;s the code, with actual names switched for generic ones to limit confusion.\/* Get the list of Hotkey commands *\/ #define A_COMMANDS_MACRO(a, b, c, d) a = b , enum { #include &#8220;commandsFile.def&#8221; } ; #undef A_COMMANDS_MACROThis is a snippet from some source code I have been looking over and considering forking as a way to familiarize myself with the intricacies of the C programming language. So, to my untrained eye, this appears to do nothing. To my brain, defining something<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/940788b98e8e9f2c47c63491ef1011c4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nchalmers<br \/>\nruby undef<br \/>\nPossible Duplicate:undef &#8211; Why would you want to undefine a method in ruby? Can anyone lay out a practical use for undef in ruby? I&#8217;m coming from languages like javascript and python that don&#8217;t have it built in. You could of course simulate it in a language like javascript:var obj = { func:function(){alert(&#8220;works&#8221;)} } obj.func() \/\/ -&gt; &#8220;works&#8221; delete(obj[&#8220;func&#8221;]) obj.func() \/\/-&gt;obj.func() is not a functionbut I&#8217;ve never really had use for that. Are there some common situations where undef<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/73c478b60c371abe43bb7ac15ff3666d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\niammilind<br \/>\nc++ c coding-style macros undef<br \/>\nIn many of the C and C++ files I have seen macros like this:#ifdef X #undef X \/\/ no statements in between #endifI feel that, it&#8217;s adequate to simply write:#undef XIf the macro X wasn&#8217;t defined, then the #undef should have no effect.Is it ok to put standalone #undef, if I want to only undefine a macro ? Does that make the coding practice bad in anyway ?<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9846a7c80fd359b7653d9e5c639e3b22?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDennis Miller<br \/>\ndoxygen undef<br \/>\nI currently have a couple of #define in c files that turn off some functionality to hardware for testing. However, I want to document them with doxygen when they are undefined as well.For example:This works fine:\/\/\/ \\def SIMULATE_SOME_HW_INTERFACE \/\/\/ Define this when you want to simulate HW interface. #define SIMULATE_SOME_HW_INTERFACEWhen you change the #define to #undef, you get a warning in doxygen, and it doesn&#8217;t show up in the doxygen generated output. I want to document this #define wethe<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e4bac7ebd5f5a06c716f508af656e24b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ntemplatetypedef<br \/>\nc++ visual-studio-2010 main undef<br \/>\nI&#8217;m working with MVisualC++ 2010 and when I try to undefine the &#8220;main&#8221;, there&#8217;s no result and the console launches as usual. I was expecting some missing entry point error or something. Why is that?#undef main int main() { }<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/edd8638efe875601bfe394a8aea5b16d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbrian d foy<br \/>\nperl undef<br \/>\nI have a fragment in this form:my $a = $some_href-&gt;{$code}{&#8216;A&#8217;}; # a number or undef my $b = $some_href-&gt;{$code}{&#8216;B&#8217;}; # a number or undef $a = 0 unless defined($a); $b = 0 unless defined($b); my $total = $a + $b;The reality is even more messy, since more than two variables are concerned.What I really want to write is this:my $total = $some_href-&gt;{$code}{&#8216;A&#8217;} + $some_href-&gt;{$code}{&#8216;B&#8217;};and have undef correctly evaluate to 0 but I get these warnings in almost every run:Use of uninitia<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/009d980607f54a15e245c1c3b9fa6e47?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nzigdon<br \/>\nperl warnings undef<br \/>\nHow do you get Perl to stop and give a stack trace when you reference an undef value, rather than merely warning? It seems that use strict; isn&#8217;t sufficient for this purpose.<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c99b0828fcbb6862da486e3b31dc7c76?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ntunnuz<br \/>\nc++ undef<br \/>\nI&#8217;m working in C++ and I need to know if a scalar value (for instance a double) is &#8220;defined&#8221; or not. I also need to be able to &#8220;undef&#8221; it if needed:class Foo { public:double get_bar();private:double bar;void calculate_bar() {bar = something();} };double Foo::get_bar() {if ( undefined(bar) )calculate_bar();return bar; }Is it possible in C++?Thanks<\/li>\n<li>\n<img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/edd8638efe875601bfe394a8aea5b16d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbrian d foy<br \/>\nperl printf undef<br \/>\nI&#8217;m looking for an elegant way to denote undefined values in situations where formatted numbers usually render. I&#8217;ll work up a small example. For starters, you of course can&#8217;t use this:#!\/usr\/bin\/perl use strict; use warnings; for my $s (1, 1.2, undef, 1.3) {printf &#8220;%5.2f\\n&#8221;, $s; }&#8230;because the &#8216;use warnings&#8217; nails you with &#8216;Use of uninitialized value&#8230;&#8217; on the third iteration. So the next step is something like this:#!\/usr\/bin\/perl use strict; use warnings; for my $s (1, 1.2, undef, 1.3) {pri<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2014-01-12 20:47:27. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>mattk erlang undef cowboy I am trying to run a custom application but get multiple errors. I believe the main egs app gets an error because it calls the egs patch app which has an undefined type. I cant figure out how to get this working I have tried recompiling the code many times in [&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-2439","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2439","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=2439"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2439\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}