Can’t Stand it When…

1) … when people say they write code in Assembler. Now, if that sentence didn’t vibe you, then probably you shouldn’t read any futher. It’s like I will tell someone that I know to code in Compiler. And that’s wrong, you don’t code in compiler, you use a compiler in order to compile your code in whatever language you really write in. So the proper word would be “Assembly”. And I encounter too many people, who knows some Assembly too, that say it incorrectly and it freaks me out. The next thing I reply is “you write in compiler, ohhh wow, very nice”, but they don’t get it.

2) … when you think you’re cool and you don’t use goto’s because most people think it’s a bad habit and yet you do it indirectly and you are cooler now. I will just show some code snippet and say no more than – your code should be readable, not making you a cool haxor guy (well maybe that too), and using goto for cleaning resources is legitimate !!!!

status = success;

do {
  p = (char*)malloc(1000);
  if (p == NULL) {
  status = fail;
   break; // <— oh yeah biatch.
 } while (FALSE); // <— oh no, so lame.
 if (status != success) {
  if (p) free(p);
  if (bla) free(bla);
  return status;

 status = do_more_stuff(…);
 return status;

3) … when something wrong happens internally in some function and you don’t bubble up the return code up to the caller and you pretend “business as usual” when something is seriously wrong. Then some guy like me needs to come in and debug the flow control to find out what went wrong.

4) … when you cannot disassemble any address you want in Visual Studio debugger (under Platform Builder) and you need to change the PC (IP on ARM) to whatever value and go to “Show Current Statement” and only then set a breakpoint there and view the Assembly code and then fix back the PC to the original’s value.

Got some more? Share them with us.

3 Responses to “Can’t Stand it When…”

  1. AmiRach says:

    #4, so true! I Hate that..

  2. Erez says:

    About #2,
    All if/whiles are essentially gotos; it’s not about using gotos, but how to use them. break/continue are gotos to very specific points of the code (which are inside the current and well-defined code-block), and usually the reason for using them is clear.

    As for goto for cleaning resources, I’m completely with you.
    There is no real difference, practical or theorerical, between
    goto end_of_func;

  3. arkon says:

    Erez, I completely agree with you. My point was that you shouldn’t fool yourself, use goto’s where due.

Leave a Reply