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. Braces

Braces

Scheduled Pinned Locked Moved The Lounge
question
23 Posts 13 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.
  • Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #1

    No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

    The difficult we do right away... ...the impossible takes slightly longer.

    D P L Greg UtasG R 10 Replies Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

      The difficult we do right away... ...the impossible takes slightly longer.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Got an example? The few things I looked up haven't changed their formatting.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
      Dave Kreskowiak

      Richard Andrew x64R 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

        The difficult we do right away... ...the impossible takes slightly longer.

        P Offline
        P Offline
        peterkmx
        wrote on last edited by
        #3

        Not really .. here I see Allman :confused: [Directory.GetFiles Method (System.IO) | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?view=net-5.0)

        Richard Andrew x64R 1 Reply Last reply
        0
        • Richard Andrew x64R Richard Andrew x64

          No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

          The difficult we do right away... ...the impossible takes slightly longer.

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

          Well, I think it's important to remember that coding styles are personal preferences and opinions. Although I also prefer the BSD style I must admit.... being exposed to several styles increases my code comprehension levels. Here is a very old survey from the 7th of May 2012 with my comments on the subject. Do you have a coding style?[^] Best Wishes, -David Delaune

          Richard Andrew x64R M 2 Replies Last reply
          0
          • D Dave Kreskowiak

            Got an example? The few things I looked up haven't changed their formatting.

            Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
            Dave Kreskowiak

            Richard Andrew x64R Offline
            Richard Andrew x64R Offline
            Richard Andrew x64
            wrote on last edited by
            #5

            Here's an example: ADDRINFOW (ws2def.h) - Win32 apps | Microsoft Docs[^]

            The difficult we do right away... ...the impossible takes slightly longer.

            D 1 Reply Last reply
            0
            • L Lost User

              Well, I think it's important to remember that coding styles are personal preferences and opinions. Although I also prefer the BSD style I must admit.... being exposed to several styles increases my code comprehension levels. Here is a very old survey from the 7th of May 2012 with my comments on the subject. Do you have a coding style?[^] Best Wishes, -David Delaune

              Richard Andrew x64R Offline
              Richard Andrew x64R Offline
              Richard Andrew x64
              wrote on last edited by
              #6

              I agree with your comments. The BSD style does improve readability regarding scope.

              The difficult we do right away... ...the impossible takes slightly longer.

              L 1 Reply Last reply
              0
              • P peterkmx

                Not really .. here I see Allman :confused: [Directory.GetFiles Method (System.IO) | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?view=net-5.0)

                Richard Andrew x64R Offline
                Richard Andrew x64R Offline
                Richard Andrew x64
                wrote on last edited by
                #7

                ADDRINFOW (ws2def.h) - Win32 apps | Microsoft Docs[^]

                The difficult we do right away... ...the impossible takes slightly longer.

                1 Reply Last reply
                0
                • Richard Andrew x64R Richard Andrew x64

                  Here's an example: ADDRINFOW (ws2def.h) - Win32 apps | Microsoft Docs[^]

                  The difficult we do right away... ...the impossible takes slightly longer.

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  Yuk! No, no, no. This will not do. At the very least, they need to implement an option to pick the formatting you want. I find that format a problem because newbs seem to mis-match braces all the time while using it.

                  Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                  Dave Kreskowiak

                  Richard Andrew x64R 1 Reply Last reply
                  0
                  • Richard Andrew x64R Richard Andrew x64

                    I agree with your comments. The BSD style does improve readability regarding scope.

                    The difficult we do right away... ...the impossible takes slightly longer.

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

                    Richard Andrew x64 wrote:

                    I agree with your comments.

                    I wrote that comment nearly a decade ago. It's interesting that my opinion has not changed. By the way, what we were discussing earlier regarding namespace using-declarations is also just an opinion. These things are not really important. It's about personal preference. Best Wishes, -David Delaune

                    1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      Yuk! No, no, no. This will not do. At the very least, they need to implement an option to pick the formatting you want. I find that format a problem because newbs seem to mis-match braces all the time while using it.

                      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                      Dave Kreskowiak

                      Richard Andrew x64R Offline
                      Richard Andrew x64R Offline
                      Richard Andrew x64
                      wrote on last edited by
                      #10

                      And that's exactly why I dislike that style, because it makes it difficult to, as Randor said, see where the scopes begin and end.

                      The difficult we do right away... ...the impossible takes slightly longer.

                      1 Reply Last reply
                      0
                      • Richard Andrew x64R Richard Andrew x64

                        No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

                        The difficult we do right away... ...the impossible takes slightly longer.

                        Greg UtasG Offline
                        Greg UtasG Offline
                        Greg Utas
                        wrote on last edited by
                        #11

                        Allman makes the braces easy to match up. But more importantly, it makes conditions easy to read because the left brace is alone on the following line. Most styles squander horizontal space but are miserly when it comes to vertical space.

                        Robust Services Core | Software Techniques for Lemmings | Articles
                        The fox knows many things, but the hedgehog knows one big thing.

                        <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                        <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                        R 1 Reply Last reply
                        0
                        • Richard Andrew x64R Richard Andrew x64

                          No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

                          The difficult we do right away... ...the impossible takes slightly longer.

                          R Offline
                          R Offline
                          Rick York
                          wrote on last edited by
                          #12

                          Curiously, the actual header file itself use the Allman style. The curious part being it was changed for the documentation.

                          typedef struct addrinfoW
                          {
                          int ai_flags; // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST
                          int ai_family; // PF_xxx
                          int ai_socktype; // SOCK_xxx
                          int ai_protocol; // 0 or IPPROTO_xxx for IPv4 and IPv6
                          size_t ai_addrlen; // Length of ai_addr
                          PWSTR ai_canonname; // Canonical name for nodename
                          _Field_size_bytes_(ai_addrlen) struct sockaddr * ai_addr; // Binary address
                          struct addrinfoW * ai_next; // Next structure in linked list
                          }
                          ADDRINFOW, *PADDRINFOW;

                          "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                          L 1 Reply Last reply
                          0
                          • Richard Andrew x64R Richard Andrew x64

                            No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

                            The difficult we do right away... ...the impossible takes slightly longer.

                            S Offline
                            S Offline
                            Slacker007
                            wrote on last edited by
                            #13

                            Allman style. I only do K&R for java-script.

                            1 Reply Last reply
                            0
                            • R Rick York

                              Curiously, the actual header file itself use the Allman style. The curious part being it was changed for the documentation.

                              typedef struct addrinfoW
                              {
                              int ai_flags; // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST
                              int ai_family; // PF_xxx
                              int ai_socktype; // SOCK_xxx
                              int ai_protocol; // 0 or IPPROTO_xxx for IPv4 and IPv6
                              size_t ai_addrlen; // Length of ai_addr
                              PWSTR ai_canonname; // Canonical name for nodename
                              _Field_size_bytes_(ai_addrlen) struct sockaddr * ai_addr; // Binary address
                              struct addrinfoW * ai_next; // Next structure in linked list
                              }
                              ADDRINFOW, *PADDRINFOW;

                              "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

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

                              Well, Historically the employees that write the MSDN documentation are not FTE (Blue) but V-dash or A-dash[^] employees. The contribution they make is very much appreciated but they usually have restricted access to resources and source code. The documentation reflects that. Recently there has been an internal push for some dedicated FTE and resource allocations dedicated to documentation.

                              1 Reply Last reply
                              0
                              • Richard Andrew x64R Richard Andrew x64

                                No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

                                The difficult we do right away... ...the impossible takes slightly longer.

                                J Offline
                                J Offline
                                Jacquers
                                wrote on last edited by
                                #15

                                I've been doing a lot of Typescript lately and become so used to K&R style that when I switch back to C# I looks weird.

                                1 Reply Last reply
                                0
                                • Richard Andrew x64R Richard Andrew x64

                                  No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

                                  The difficult we do right away... ...the impossible takes slightly longer.

                                  J Offline
                                  J Offline
                                  Jorgen Andersson
                                  wrote on last edited by
                                  #16

                                  Seems to be language dependent. C# is all Allman as far as I can see.

                                  Wrong is evil and must be defeated. - Jeff Ello

                                  1 Reply Last reply
                                  0
                                  • Richard Andrew x64R Richard Andrew x64

                                    No, not orthodonture. Has anyone else noticed that Microsoft has reformatted all of their online documentation to use K&R style braces instead of Allman style? I personally prefer the previous (Allman) style.

                                    The difficult we do right away... ...the impossible takes slightly longer.

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

                                    Well, everything else has been fixed already, so that was the next item they had to deal with...

                                    Richard Andrew x64R 1 Reply Last reply
                                    0
                                    • D dandy72

                                      Well, everything else has been fixed already, so that was the next item they had to deal with...

                                      Richard Andrew x64R Offline
                                      Richard Andrew x64R Offline
                                      Richard Andrew x64
                                      wrote on last edited by
                                      #18

                                      Yeah, after fixing all the icons, what is there left to do?

                                      The difficult we do right away... ...the impossible takes slightly longer.

                                      1 Reply Last reply
                                      0
                                      • Greg UtasG Greg Utas

                                        Allman makes the braces easy to match up. But more importantly, it makes conditions easy to read because the left brace is alone on the following line. Most styles squander horizontal space but are miserly when it comes to vertical space.

                                        Robust Services Core | Software Techniques for Lemmings | Articles
                                        The fox knows many things, but the hedgehog knows one big thing.

                                        R Offline
                                        R Offline
                                        Rusty Bullet
                                        wrote on last edited by
                                        #19

                                        That is because readability becomes less important when publishing. Vertical space means $$$, so it trumps readability.

                                        Greg UtasG 1 Reply Last reply
                                        0
                                        • R Rusty Bullet

                                          That is because readability becomes less important when publishing. Vertical space means $$$, so it trumps readability.

                                          Greg UtasG Offline
                                          Greg UtasG Offline
                                          Greg Utas
                                          wrote on last edited by
                                          #20

                                          That's probably how K&R started, so people then thought it was the right way to do it.

                                          Robust Services Core | Software Techniques for Lemmings | Articles
                                          The fox knows many things, but the hedgehog knows one big thing.

                                          <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                                          <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                                          R 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