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. Semicolon at the end of a comment line.

Semicolon at the end of a comment line.

Scheduled Pinned Locked Moved The Lounge
31 Posts 16 Posters 3 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.
  • S Single Step Debugger

    Better than a semicolon at the end of an "if" statement. :sigh: took me a half day to realize why my coworker's code is not working.

    Advertise here – minimum three posts per day are guaranteed.

    D Offline
    D Offline
    DrWalter PE
    wrote on last edited by
    #9

    Beware of coworkers with a malfunctioning cod piece!

    J 1 Reply Last reply
    0
    • D DrWalter PE

      Beware of coworkers with a malfunctioning cod piece!

      J Offline
      J Offline
      jeron1
      wrote on last edited by
      #10

      Mind bleach, I need mind bleach!!! X|

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

      1 Reply Last reply
      0
      • P Pete OHanlon

        Their cod wasn't working? That sounds fishy to me.

        Advanced TypeScript Programming Projects

        D Offline
        D Offline
        DrWalter PE
        wrote on last edited by
        #11

        Pete O'Hanlon wrote:

        heir cod wasn't working? That sounds fishy to me.

        Beware of people with a non functional cod piece.

        J 1 Reply Last reply
        0
        • D DrWalter PE

          Pete O'Hanlon wrote:

          heir cod wasn't working? That sounds fishy to me.

          Beware of people with a non functional cod piece.

          J Offline
          J Offline
          jeron1
          wrote on last edited by
          #12

          Mind bleach, I need mind bleach!!! X|

          "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

          1 Reply Last reply
          0
          • H honey the codewitch

            For some reason - maybe it's my editor? - but lately I've been dropping a lot of { open braces after if (K&R style for me in C/C++) and it rains absolute mayhem down on my source code. My editor lights up like a $5 {expletive, use your imagination}, and of course nothing compiles. It's also just the sort of thing your brain will fill in for you automatically if it's not there while scanning code. Thanks brain!

            To err is human. Fortune favors the monsters.

            E Offline
            E Offline
            englebart
            wrote on last edited by
            #13

            I always use braces, even when not required. It future proofs for later maintenance. There was a great article supporting the always use braces approach, but I can’t remember the exact format used. The article had extensive test cases around merging changes from multiple branches and showed how braces protected correct merging. I have tried googling it, but with no luck. I guess I could just Chat GPT to provide the answer now? And if I do not like the answer then I will ask Chat GPT to write a white paper proving that my preferred brace style is superior and force my team to adopt it.

            H 1 Reply Last reply
            0
            • E englebart

              I always use braces, even when not required. It future proofs for later maintenance. There was a great article supporting the always use braces approach, but I can’t remember the exact format used. The article had extensive test cases around merging changes from multiple branches and showed how braces protected correct merging. I have tried googling it, but with no luck. I guess I could just Chat GPT to provide the answer now? And if I do not like the answer then I will ask Chat GPT to write a white paper proving that my preferred brace style is superior and force my team to adopt it.

              H Offline
              H Offline
              honey the codewitch
              wrote on last edited by
              #14

              I *was* using braces. I'm talking about typing:

              if(foo!=nullptr)
              printf("foo valid\n");
              }

              Like that.

              To err is human. Fortune favors the monsters.

              E J 2 Replies Last reply
              0
              • H honey the codewitch

                I *was* using braces. I'm talking about typing:

                if(foo!=nullptr)
                printf("foo valid\n");
                }

                Like that.

                To err is human. Fortune favors the monsters.

                E Offline
                E Offline
                englebart
                wrote on last edited by
                #15

                At least it is a syntax error. That is a scenario where you can ask the editor to re-format for you and then compare with pre-format to see what shifted/indented unexpectedly. Like you said, the indentation will trick you into not noticing the missing {. The one that bit me was if () // do foo foo(); and I added prefoo(); ahead of foo(); without adding braces. “It was a setup, I tell you, wiseguy”

                W H 2 Replies Last reply
                0
                • E englebart

                  At least it is a syntax error. That is a scenario where you can ask the editor to re-format for you and then compare with pre-format to see what shifted/indented unexpectedly. Like you said, the indentation will trick you into not noticing the missing {. The one that bit me was if () // do foo foo(); and I added prefoo(); ahead of foo(); without adding braces. “It was a setup, I tell you, wiseguy”

                  W Offline
                  W Offline
                  Wizard of Sleeves
                  wrote on last edited by
                  #16

                  This is why I *always* use braces after an if is there is only one line of code ...

                  if(expression == true) {
                  doSomething();
                  }

                  Then later when reviewing my code, I decide to tidy it up because it looks nicer ...

                  if(expression == true) doSomething();

                  Third time around I add one line of code and spend the rest of the day trying to figure out why nothing works.

                  Nothing succeeds like a budgie without teeth. To err is human, to arr is pirate.

                  1 Reply Last reply
                  0
                  • E englebart

                    At least it is a syntax error. That is a scenario where you can ask the editor to re-format for you and then compare with pre-format to see what shifted/indented unexpectedly. Like you said, the indentation will trick you into not noticing the missing {. The one that bit me was if () // do foo foo(); and I added prefoo(); ahead of foo(); without adding braces. “It was a setup, I tell you, wiseguy”

                    H Offline
                    H Offline
                    honey the codewitch
                    wrote on last edited by
                    #17

                    Yeah, that's not a fun bug. Fortunately for me, the number of times that has happened to me I can count on one hand.

                    To err is human. Fortune favors the monsters.

                    1 Reply Last reply
                    0
                    • H honey the codewitch

                      I *was* using braces. I'm talking about typing:

                      if(foo!=nullptr)
                      printf("foo valid\n");
                      }

                      Like that.

                      To err is human. Fortune favors the monsters.

                      J Offline
                      J Offline
                      JohnDG52
                      wrote on last edited by
                      #18

                      That closing curly kicks my OCD right where it hurts.

                      1 Reply Last reply
                      0
                      • R Ron Anders

                        Too late, already pressed F5, Someday I or someone will get a mild chuckle.

                        W Offline
                        W Offline
                        WPerkins
                        wrote on last edited by
                        #19

                        I found myself (in the old days) putting periods at the end of COBOL comments... but that was OK.

                        1 Reply Last reply
                        0
                        • S Single Step Debugger

                          Better than a semicolon at the end of an "if" statement. :sigh: took me a half day to realize why my coworker's code is not working.

                          Advertise here – minimum three posts per day are guaranteed.

                          P Offline
                          P Offline
                          Peter Adam
                          wrote on last edited by
                          #20

                          That is a perfectly valid SAS code[^]. I still don't believe in it when I see it.

                          1 Reply Last reply
                          0
                          • S Single Step Debugger

                            Edit: got it (the fishy part) :) Here, let me clear the picture:

                            if(obj->nVar > 0);
                            {
                            //unreachable code
                            //more unreachable code
                            //even more unreachable code
                            }

                            It was verry confusing because it was CLI manageable section and without a special pragma you cannot debug this code.

                            Advertise here – minimum three posts per day are guaranteed.

                            J Offline
                            J Offline
                            James Curran
                            wrote on last edited by
                            #21

                            um... Not only would that ode be reachable, it would be executed every time.

                            Truth, James

                            S 1 Reply Last reply
                            0
                            • J James Curran

                              um... Not only would that ode be reachable, it would be executed every time.

                              Truth, James

                              S Offline
                              S Offline
                              Single Step Debugger
                              wrote on last edited by
                              #22

                              Yes, exactly - bad wording on my side.

                              Advertise here – minimum three posts per day are guaranteed.

                              1 Reply Last reply
                              0
                              • S Single Step Debugger

                                Better than a semicolon at the end of an "if" statement. :sigh: took me a half day to realize why my coworker's code is not working.

                                Advertise here – minimum three posts per day are guaranteed.

                                D Offline
                                D Offline
                                dandy72
                                wrote on last edited by
                                #23

                                Single Step Debugger wrote:

                                Better than a semicolon at the end of an "if" statement.

                                That's a fun one. Back in my college days, a fellow student (much older than the rest of us, I think he decided to go back to college in his 40s) had the habit of leaving his system logged in, with his editor running...so whenever he took a break to (typically) go pick something up at the cafeteria, we'd do things like adding a bunch of spaces after a for loop and then a semi-colon (so it's off-screen and not visible), so his code read:

                                for ( int i = 0; i < someLimit; i++ ) ; <-- not visible without scrolling horizontally
                                {
                                // this only ran once no matter what
                                }

                                We did it many times, but he never learned to lock his workstation...fool me once... Poor guy. He was already struggling, and we made him waste a lot of his time on things like this... Gaetan, wherever you are, I hope you still had a successful and rewarding career... :rose:

                                S 1 Reply Last reply
                                0
                                • D dandy72

                                  Single Step Debugger wrote:

                                  Better than a semicolon at the end of an "if" statement.

                                  That's a fun one. Back in my college days, a fellow student (much older than the rest of us, I think he decided to go back to college in his 40s) had the habit of leaving his system logged in, with his editor running...so whenever he took a break to (typically) go pick something up at the cafeteria, we'd do things like adding a bunch of spaces after a for loop and then a semi-colon (so it's off-screen and not visible), so his code read:

                                  for ( int i = 0; i < someLimit; i++ ) ; <-- not visible without scrolling horizontally
                                  {
                                  // this only ran once no matter what
                                  }

                                  We did it many times, but he never learned to lock his workstation...fool me once... Poor guy. He was already struggling, and we made him waste a lot of his time on things like this... Gaetan, wherever you are, I hope you still had a successful and rewarding career... :rose:

                                  S Offline
                                  S Offline
                                  Single Step Debugger
                                  wrote on last edited by
                                  #24

                                  That's so evil! I like it! :-D

                                  Advertise here – minimum three posts per day are guaranteed.

                                  D 1 Reply Last reply
                                  0
                                  • S Single Step Debugger

                                    Better than a semicolon at the end of an "if" statement. :sigh: took me a half day to realize why my coworker's code is not working.

                                    Advertise here – minimum three posts per day are guaranteed.

                                    T Offline
                                    T Offline
                                    trønderen
                                    wrote on last edited by
                                    #25

                                    Didn't your compiler warn you about a 'possibly unintended empty statement' or something like that? (Or have you disabled that error message?)

                                    S 1 Reply Last reply
                                    0
                                    • S Single Step Debugger

                                      Better than a semicolon at the end of an "if" statement. :sigh: took me a half day to realize why my coworker's code is not working.

                                      Advertise here – minimum three posts per day are guaranteed.

                                      A Offline
                                      A Offline
                                      Alister Morton
                                      wrote on last edited by
                                      #26

                                      BTDTGTTS

                                      1 Reply Last reply
                                      0
                                      • S Single Step Debugger

                                        That's so evil! I like it! :-D

                                        Advertise here – minimum three posts per day are guaranteed.

                                        D Offline
                                        D Offline
                                        dandy72
                                        wrote on last edited by
                                        #27

                                        All students had some storage on a Novell network... I forget the details - either all storage was accessible by all by default, or we could create shares accessible to anyone or whoever we wanted to share with. That was back in the DOS days where you didn't have a GUI to multi-select files/folders and delete them in a single operation. You could delete files in bulk at a command prompt using wildcards, but only in a given folder - not recursively - you then had to navigate to a different folder and repeat. I knew people were poking around and taking stuff from each other, and running random EXEs they found (!), so I created a small program with an intriguing filename, such as, I don't know, "decodepwds.exe" that identified the user's home folder, and generated in it a hierarchy of folders with extended-ASCII names until the file system started reporting errors (there was probably a quota policy in place). Since you couldn't recursively delete folders in bulk, you were stuck with these folders with names that were difficult to type in...I *had* heard of people having no choice but to go to the IT admin and asking to get their account reset because they had run out of space, and had no idea how to delete all that crap. The IT guy had no clue where this was coming from, since the origin of said files/folders didn't get logged anywhere - and the owner of the files was the person running the EXE, so they couldn't blame someone else. That's probably the worst I had ever done. :-) Sad thing is, even today, people *would* run a random EXE they found somewhere if the filename was interesting enough.

                                        1 Reply Last reply
                                        0
                                        • T trønderen

                                          Didn't your compiler warn you about a 'possibly unintended empty statement' or something like that? (Or have you disabled that error message?)

                                          S Offline
                                          S Offline
                                          Single Step Debugger
                                          wrote on last edited by
                                          #28

                                          Huge legacy project 5+ million ROC - tons of warnings. :sigh:

                                          Advertise here – minimum three posts per day are guaranteed.

                                          T 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