Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Silly?!!

Silly?!!

Scheduled Pinned Locked Moved The Lounge
question
46 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nader Elshehabi
    wrote on last edited by
    #1

    Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

    A G R R J 13 Replies Last reply
    0
    • N Nader Elshehabi

      Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

      A Offline
      A Offline
      Anna Jayne Metcalfe
      wrote on last edited by
      #2

      A string buffer overflow inside an if statement that caused the conditional to turn into an infinite loop. :doh: That was quite an eye opener...the machine was a Z-80 running CP/M+, and I was using a command line compiler without a source debugger. I finally figured it out by single stepping the disassembly under Z8E (a remarkable advanced freeware assembly debugger of the time). :)

      Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

      1 Reply Last reply
      0
      • N Nader Elshehabi

        Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

        G Offline
        G Offline
        gantww
        wrote on last edited by
        #3

        if((a != b) & (a == c) & (c == b)) //a, b, and c are integers { //Do something } else { //throw nasty exception that when caught results in email being sent to multiple individuals and blaming dumb users. Also, //keep trying, as maybe it will be different next time. Yeah, that's the ticket... }

        C 1 Reply Last reply
        0
        • N Nader Elshehabi

          Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

          R Offline
          R Offline
          Rama Krishna Vavilala
          wrote on last edited by
          #4

          Many, it will be a long list and I found some of them late after looking at the debug dumps. It took me a while to figure out the silly mistake that I am describing in this post. I found out that I committ mistakes more if I want to write complex code trying to over optimize something. Since then, I keep things simple. The code went something like this:

          class FieldDataHolder
          {
          union
          {
          double doubleData;
          char[16] stringData;
          } data;
          }

          class Field
          {

          void* pData;

          Field()
          {
          pData = &data;
          }
          }

          The problem came when I added a whole bunch of Fields to a vector of Fields. -- modified at 16:36 Wednesday 16th August, 2006


          Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

          1 Reply Last reply
          0
          • N Nader Elshehabi

            Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

            R Offline
            R Offline
            RC_Sebastien_C
            wrote on last edited by
            #5

            I asked a programming question in the Lounge once

            N C G 3 Replies Last reply
            0
            • N Nader Elshehabi

              Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

              J Offline
              J Offline
              Jeremy Falcon
              wrote on last edited by
              #6

              Nader Elshehabi wrote:

              What is the most funny, silly, ridiculous programming mistake you ever made??

              I've made too many to count. :rolleyes: Although, one of the oddities I tend to do is when I haven't programmed in VB (for work, cut me some slack :)) for years after a long stint of C/C++, I'll instinctively put semicolons at the end of the lines.

              Nader Elshehabi wrote:

              Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it.

              That reminds me; don't try to upgrade a non-upgradeable PC. My first PC had a feature to store DOS 2.1 (or maybe it was 2.2) bootstrap code on ROM that showed up as a fake drive C: so you didn't need a diskette to start the computer. I'll make a long story short and say it didn't survive the upgrade. Oh how we learn. :-D

              Jeremy Falcon

              1 Reply Last reply
              0
              • N Nader Elshehabi

                Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

                M Offline
                M Offline
                Maximilien
                wrote on last edited by
                #7

                regressing from C++ programming to C programming ( using a C compiler ):

                int someFunction( )
                {
                /// declared some variables...
                /// do something ...

                int iSomeResults;

                /// continue doing something else.
                /// ...
                }

                it took us ( 4 person ) at least 1/2 hour to figure it out. :|


                Maximilien Lincourt Your Head A Splode - Strong Bad

                J 1 Reply Last reply
                0
                • M Maximilien

                  regressing from C++ programming to C programming ( using a C compiler ):

                  int someFunction( )
                  {
                  /// declared some variables...
                  /// do something ...

                  int iSomeResults;

                  /// continue doing something else.
                  /// ...
                  }

                  it took us ( 4 person ) at least 1/2 hour to figure it out. :|


                  Maximilien Lincourt Your Head A Splode - Strong Bad

                  J Offline
                  J Offline
                  Jeremy Falcon
                  wrote on last edited by
                  #8

                  Maximilien wrote:

                  it took us ( 4 person ) at least 1/2 hour to figure it out.

                  I actually like that fact about C. It helps enforce better variable usage and planning IMO. Most people tend to throw them around as if they are candy.

                  Jeremy Falcon

                  G C S 3 Replies Last reply
                  0
                  • R RC_Sebastien_C

                    I asked a programming question in the Lounge once

                    N Offline
                    N Offline
                    Nader Elshehabi
                    wrote on last edited by
                    #9

                    OUCH!!:laugh:

                    J 1 Reply Last reply
                    0
                    • J Jeremy Falcon

                      Maximilien wrote:

                      it took us ( 4 person ) at least 1/2 hour to figure it out.

                      I actually like that fact about C. It helps enforce better variable usage and planning IMO. Most people tend to throw them around as if they are candy.

                      Jeremy Falcon

                      G Offline
                      G Offline
                      gantww
                      wrote on last edited by
                      #10

                      Is it something about where the variable was declared? I'm really rusty on my C.

                      J 1 Reply Last reply
                      0
                      • G gantww

                        Is it something about where the variable was declared? I'm really rusty on my C.

                        J Offline
                        J Offline
                        Jeremy Falcon
                        wrote on last edited by
                        #11

                        gantww wrote:

                        Is it something about where the variable was declared?

                        Programming Question!!!!! ;P But yeah, in C you have to declare in them a block before you do anything else. If you really wanted to declare something in the middle of a block just put it in brackets for a new block.

                        Jeremy Falcon

                        1 Reply Last reply
                        0
                        • N Nader Elshehabi

                          OUCH!!:laugh:

                          J Offline
                          J Offline
                          Jeremy Falcon
                          wrote on last edited by
                          #12

                          Well, the upside was, after it was fried, I was able to open up the computer and learn about hardware.

                          Jeremy Falcon

                          1 Reply Last reply
                          0
                          • J Jeremy Falcon

                            Maximilien wrote:

                            it took us ( 4 person ) at least 1/2 hour to figure it out.

                            I actually like that fact about C. It helps enforce better variable usage and planning IMO. Most people tend to throw them around as if they are candy.

                            Jeremy Falcon

                            C Offline
                            C Offline
                            Christian Graus
                            wrote on last edited by
                            #13

                            I disagree, I think it's good form to declare variables where you're going to use them, to limit their scope.

                            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                            J 1 Reply Last reply
                            0
                            • J Jeremy Falcon

                              Maximilien wrote:

                              it took us ( 4 person ) at least 1/2 hour to figure it out.

                              I actually like that fact about C. It helps enforce better variable usage and planning IMO. Most people tend to throw them around as if they are candy.

                              Jeremy Falcon

                              S Offline
                              S Offline
                              Shog9 0
                              wrote on last edited by
                              #14

                              Jeremy Falcon wrote:

                              Most people tend to throw them around as if they are candy.

                              What, like they're cheap? :rolleyes:

                              ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                              J 1 Reply Last reply
                              0
                              • C Christian Graus

                                I disagree, I think it's good form to declare variables where you're going to use them, to limit their scope.

                                Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                                J Offline
                                J Offline
                                Jeremy Falcon
                                wrote on last edited by
                                #15

                                Christian Graus wrote:

                                I think it's good form to declare variables where you're going to use them, to limit their scope.

                                Me too, and C doesn't stop you from doing that. Every block has their own scope. If you need to limit the scope of a variable then surround it in a new block. But, in my experience I've seen that declaring variables on the fly as you need them (generalizing) tends to lead to wasting them.

                                Jeremy Falcon

                                S 1 Reply Last reply
                                0
                                • S Shog9 0

                                  Jeremy Falcon wrote:

                                  Most people tend to throw them around as if they are candy.

                                  What, like they're cheap? :rolleyes:

                                  ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                                  J Offline
                                  J Offline
                                  Jeremy Falcon
                                  wrote on last edited by
                                  #16

                                  Maybe I should start a Variable Financing company.

                                  Jeremy Falcon

                                  1 Reply Last reply
                                  0
                                  • J Jeremy Falcon

                                    Christian Graus wrote:

                                    I think it's good form to declare variables where you're going to use them, to limit their scope.

                                    Me too, and C doesn't stop you from doing that. Every block has their own scope. If you need to limit the scope of a variable then surround it in a new block. But, in my experience I've seen that declaring variables on the fly as you need them (generalizing) tends to lead to wasting them.

                                    Jeremy Falcon

                                    S Offline
                                    S Offline
                                    Shog9 0
                                    wrote on last edited by
                                    #17

                                    Jeremy Falcon wrote:

                                    If you need to limit the scope of a variable then surround it in a new block.

                                    I really wish more people would do that. There are still far too many methods around that start out with a page of local variable definitions. X|

                                    ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                                    J 1 Reply Last reply
                                    0
                                    • S Shog9 0

                                      Jeremy Falcon wrote:

                                      If you need to limit the scope of a variable then surround it in a new block.

                                      I really wish more people would do that. There are still far too many methods around that start out with a page of local variable definitions. X|

                                      ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                                      J Offline
                                      J Offline
                                      Jeremy Falcon
                                      wrote on last edited by
                                      #18

                                      Shog9 wrote:

                                      There are still far too many methods around that start out with a page of local variable definitions.

                                      Well, you could look at it like the table of contents for a fine novel. :-D

                                      Jeremy Falcon

                                      1 Reply Last reply
                                      0
                                      • N Nader Elshehabi

                                        Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

                                        E Offline
                                        E Offline
                                        Ennis Ray Lynch Jr
                                        wrote on last edited by
                                        #19

                                        I installed a floppy drive cable upside down and spent 10 minutes figuring out why it kept corrupting the disk. As for programming I tend to not make silly mistakes. Sure I have my share of simple WTF's but those I usually fix without much fanfare. I suppose my biggest and silliest mistake was my first VB6 app that I was contracted to work. It was so bad that I rewrote most of it for free even though the original satisfied the wording on the contract.

                                        A man said to the universe: "Sir I exist!" "However," replied the Universe, "The fact has not created in me A sense of obligation." -- Stephen Crane

                                        N 1 Reply Last reply
                                        0
                                        • N Nader Elshehabi

                                          Hello A silly question.. Just for the sake of sharing funny memories. What is the most funny, silly, ridiculous programming mistake you ever made??:-D Also if anybody has nice memories from the old times -when the OS was loaded each time from a 5.25" disk-, please post it. I can't seem to remember any of mine at the moment;P, but I'll sure post anything I remember. Regards:rose:

                                          J Offline
                                          J Offline
                                          Joe Woodbury
                                          wrote on last edited by
                                          #20

                                          I don't know how silly it is, but several years ago I was reviewing my "bag o' tricks", a C++ class library I'd built up over the years to cover all sorts of things. I kept coming back to a piece of code in one class that really bugged me. It seemed so badly done. There was a cryptic comment about it working, but it still bugged me. Finally, I had enough and spent a day rewriting code until I hit some stumbling blocks and simultaneously started having deja vu about what I was doing. I pressed on until it hit me; I'd tried this before and ended up in the same dead end; I'm not talking a similar dead end, but the exact same intractable problem. This time, after I rolled the code back, I put a comment block that warned me about ever trying to rewrite the code again. * * * The next one wasn't my doing, but too funny to leave out. I was running BoundsChecker on some code and getting horrible resource and memory leaks. I was stunned. Further examination found dozens of "new"s without any "delete"s all done by the same guy, who was otherwise a good developer. Then it hit me: for the previous two years he'd been doing C# programming and when he switched back to C++ he forgot there was no garbage collector. He later confirmed the same thing.

                                          Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

                                          C 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups