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. Other Discussions
  3. The Weird and The Wonderful
  4. What's missing?

What's missing?

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
31 Posts 17 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.
  • OriginalGriffO OriginalGriff

    Not always: I'm happy with

    if (a == 1 && b == 2)

    But I'd use em for

    if (a == 1 && (b == 2 || c == 3))

    Or

    if ((a == 1 && b == 2) || c == 3)

    Just to make it obvious what I meant.

    This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre. Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.

    F Offline
    F Offline
    Freak30
    wrote on last edited by
    #17

    A colleage of mine always does if ((a == 1) && (b == 2)) while I always do if (i < (n - 1)) Fortunately regarding other styles we use the same format.

    The good thing about pessimism is, that you are always either right or pleasently surprised.

    OriginalGriffO 1 Reply Last reply
    0
    • G Gary Wheeler

      if (_Framework.DuplexPlatform)
      {
      Synchronize.Visibility = Visibility.Visible;
      }
      {
      Synchronize.Visibility = Visibility.Collapsed;
      }

      *face-palm*

      Software Zen: delete this;

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #18

      Now I see: it is a ";" - and nothing else:

      if (_Framework.DuplexPlatform) ; // <= here the ; was missing
      {
      Synchronize.Visibility = Visibility.Visible;
      }
      {
      Synchronize.Visibility = Visibility.Collapsed;
      }

      G 1 Reply Last reply
      0
      • F Freak30

        A colleage of mine always does if ((a == 1) && (b == 2)) while I always do if (i < (n - 1)) Fortunately regarding other styles we use the same format.

        The good thing about pessimism is, that you are always either right or pleasently surprised.

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #19

        Fortunately C# cured me of that one - it won't let you write

        if (1 && 2)

        Because that applies a boolean operation to two integers, so there is no confusion possible with

        if (a == 1 && b == 2)

        But in C and C++, I used to use the brackets as well! :laugh:

        This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre. Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • B Bernhard Hiller

          Now I see: it is a ";" - and nothing else:

          if (_Framework.DuplexPlatform) ; // <= here the ; was missing
          {
          Synchronize.Visibility = Visibility.Visible;
          }
          {
          Synchronize.Visibility = Visibility.Collapsed;
          }

          G Offline
          G Offline
          Gary Wheeler
          wrote on last edited by
          #20

          :laugh:

          Software Zen: delete this;

          1 Reply Last reply
          0
          • G Gary Wheeler

            if (_Framework.DuplexPlatform)
            {
            Synchronize.Visibility = Visibility.Visible;
            }
            {
            Synchronize.Visibility = Visibility.Collapsed;
            }

            *face-palm*

            Software Zen: delete this;

            B Offline
            B Offline
            Brisingr Aerowing
            wrote on last edited by
            #21

            What else would be missing? :-\

            Keep Clam And Proofread -- √(-1) 23 ∑ π... And it was delicious.

            1 Reply Last reply
            0
            • G Gary Wheeler

              if (_Framework.DuplexPlatform)
              {
              Synchronize.Visibility = Visibility.Visible;
              }
              {
              Synchronize.Visibility = Visibility.Collapsed;
              }

              *face-palm*

              Software Zen: delete this;

              R Offline
              R Offline
              Rage
              wrote on last edited by
              #22

              A code review ?

              ~RaGE();

              I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

              G 1 Reply Last reply
              0
              • R Rage

                A code review ?

                ~RaGE();

                I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                G Offline
                G Offline
                Gary Wheeler
                wrote on last edited by
                #23

                Given that this product consists of over 1.2 million lines of code (that was the count two years ago), it's a variant of four products built from the same code base, and they're all maintained by the same group of six overworked developers, who has time for code reviews? The good news is our testers found the problem.

                Software Zen: delete this;

                R 1 Reply Last reply
                0
                • G Gary Wheeler

                  Given that this product consists of over 1.2 million lines of code (that was the count two years ago), it's a variant of four products built from the same code base, and they're all maintained by the same group of six overworked developers, who has time for code reviews? The good news is our testers found the problem.

                  Software Zen: delete this;

                  R Offline
                  R Offline
                  Rage
                  wrote on last edited by
                  #24

                  You seem to have time to find bugs, so ...

                  ~RaGE();

                  I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                  G 1 Reply Last reply
                  0
                  • R Rage

                    You seem to have time to find bugs, so ...

                    ~RaGE();

                    I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                    G Offline
                    G Offline
                    Gary Wheeler
                    wrote on last edited by
                    #25

                    Our test group (a fine bunch of folks, actually) found the problem. I posted my original message here because I thought the missing else keyword was funny. Apparently you agile, oops, pardon me, Agile folks don't find such things humorous. I really would like to do code reviews, given the chance. Tell you what. Here are my shoes. Take a walk in them, and let me know when you find the management support and the extra time to do code reviews. I'll wait.

                    Software Zen: delete this;

                    H 1 Reply Last reply
                    0
                    • G Gary Wheeler

                      I'm one of those insecure types who always uses braces, unless the if() fits on a single line.

                      Software Zen: delete this;

                      G Offline
                      G Offline
                      GuyThiebaut
                      wrote on last edited by
                      #26

                      Ditto - also I am becoming a firm believer in white space being good in code as it makes it much easier to read.

                      “That which can be asserted without evidence, can be dismissed without evidence.”

                      ― Christopher Hitchens

                      1 Reply Last reply
                      0
                      • N Nagy Vilmos

                        Mandatory code fix post - Why you not do inline:

                        Synchronize.Visibility = _Framework.DuplexPlatform ?
                        Visibility.Visible : Visibility.Collapsed;

                        :-D

                        speramus in juniperus

                        L Offline
                        L Offline
                        Lutoslaw
                        wrote on last edited by
                        #27

                        I agree that a ternary should be used when apropriate, but I prefer a more explicit formatting.

                        Synchronize.Visibility = _Framework.DuplexPlatform
                        ? Visibility.Visible
                        : Visibility.Collapsed;

                        A ternary operetar is used rarely enough to expose it.

                        Greetings - Jacek

                        B 1 Reply Last reply
                        0
                        • L Lutoslaw

                          I agree that a ternary should be used when apropriate, but I prefer a more explicit formatting.

                          Synchronize.Visibility = _Framework.DuplexPlatform
                          ? Visibility.Visible
                          : Visibility.Collapsed;

                          A ternary operetar is used rarely enough to expose it.

                          Greetings - Jacek

                          B Offline
                          B Offline
                          BobJanova
                          wrote on last edited by
                          #28

                          Not in my code it isn't :cool:

                          1 Reply Last reply
                          0
                          • I Ingo

                            Richard Deeming wrote:

                            Philistine!

                            And proud about it!

                            Richard Deeming wrote:

                            Allman style[^] is the only way to go.

                            Eh. In my eyes it's ridiculous. Thousand lines between the code that make it unreadable. X|

                            Richard Deeming wrote:

                            And while we're at it, it's tabs every time. Anyone who uses spaces to indent their code shall be shot.

                            Agree! :thumbsup:

                            SharePoint Consultant and Developer at acocon Author of Primary ROleplaying SysTem I'm the ninth in a row of seven!

                            H Offline
                            H Offline
                            H Brydon
                            wrote on last edited by
                            #29

                            Stop! You're both wrong. Allman style and expand tabs to spaces. Heresy! In my code base only one type of whitespace is allowed (ya ya I don't consider newlines to be whitespace).

                            Windows 8 is the resurrected version of Microsoft Bob. The only thing missing is the Fisher-Price logo. - Harvey

                            1 Reply Last reply
                            0
                            • G Gary Wheeler

                              Our test group (a fine bunch of folks, actually) found the problem. I posted my original message here because I thought the missing else keyword was funny. Apparently you agile, oops, pardon me, Agile folks don't find such things humorous. I really would like to do code reviews, given the chance. Tell you what. Here are my shoes. Take a walk in them, and let me know when you find the management support and the extra time to do code reviews. I'll wait.

                              Software Zen: delete this;

                              H Offline
                              H Offline
                              H Brydon
                              wrote on last edited by
                              #30

                              Where I worked a few years ago, we did code reviews even when rushed because we found that they reduced the amount of development time, even when rushed... no especially when rushed.

                              Windows 8 is the resurrected version of Microsoft Bob. The only thing missing is the Fisher-Price logo. - Harvey

                              1 Reply Last reply
                              0
                              • G Gary Wheeler

                                I'm one of those insecure types who always uses braces, unless the if() fits on a single line.

                                Software Zen: delete this;

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #31

                                That;s not insecurity - that's being a good developer. I upvoted you just because its nice to find folk coding the same standards as me :)

                                MVVM # - I did it My Way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                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