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. Longest line of code?

Longest line of code?

Scheduled Pinned Locked Moved The Lounge
questioncsharpcomtools
14 Posts 12 Posters 1 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.
  • L Luis Alonso Ramos

    I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


    Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

    A Offline
    A Offline
    Alexander M
    wrote on last edited by
    #3

    My limit is the display. I have 1280x1024 and when the code reaches the right border of the screen, I normally begin a new line. Don't try it, just do it! ;-)

    1 Reply Last reply
    0
    • L Luis Alonso Ramos

      I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


      Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

      N Offline
      N Offline
      Niklas Ulvinge
      wrote on last edited by
      #4

      Sometimes I keep it shorter sometimes longer.
      It's fun to align the text like this text I'm
      writing here. It's not very hard and it looks
      compact and cool. Hope you get how I wrote it
      It's not very cool but I couldnt think of any
      thing else to write. When I'm coding I've got
      a width of about two thirds of the screen.

      Niklas Ulvinge aka IDK

      L 1 Reply Last reply
      0
      • N Niklas Ulvinge

        Sometimes I keep it shorter sometimes longer.
        It's fun to align the text like this text I'm
        writing here. It's not very hard and it looks
        compact and cool. Hope you get how I wrote it
        It's not very cool but I couldnt think of any
        thing else to write. When I'm coding I've got
        a width of about two thirds of the screen.

        Niklas Ulvinge aka IDK

        L Offline
        L Offline
        Luis Alonso Ramos
        wrote on last edited by
        #5

        Niklas Ulvinge wrote: Hope you get how I wrote it Yes, you missed a period there at the end. Niklas Ulvinge wrote: I couldnt and an apostrophe... Niklas Ulvinge wrote: shorter sometimes longer Oh, also a comma :) Wouldn't it be easier to insert extra spaces?? :) -- LuisR


        Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

        N 1 Reply Last reply
        0
        • L Luis Alonso Ramos

          Niklas Ulvinge wrote: Hope you get how I wrote it Yes, you missed a period there at the end. Niklas Ulvinge wrote: I couldnt and an apostrophe... Niklas Ulvinge wrote: shorter sometimes longer Oh, also a comma :) Wouldn't it be easier to insert extra spaces?? :) -- LuisR


          Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

          N Offline
          N Offline
          Niklas Ulvinge
          wrote on last edited by
          #6

          I ment to do it like that. Maybe. But it's harder to read sometimes. I'm an assembler now and doing everything in assembler and there everying is very the same. The sytax is always like this:

          Label: instr. parameters ;comment

          Niklas Ulvinge aka IDK

          D 1 Reply Last reply
          0
          • N Niklas Ulvinge

            I ment to do it like that. Maybe. But it's harder to read sometimes. I'm an assembler now and doing everything in assembler and there everying is very the same. The sytax is always like this:

            Label: instr. parameters ;comment

            Niklas Ulvinge aka IDK

            D Offline
            D Offline
            DavidNohejl
            wrote on last edited by
            #7

            Sometimes I keep it shorter sometimes longer.
            It's fun to align the text like this text I'm
            writing here. It's not very hard and it looks
            compact and cool. Hope you get how I wrote it
            It's not very cool but I couldnt think of any
            thing else to write. When I'm coding I've got
            a width of about two thirds of the screen.

            Niklas Ulvinge aka IDK  yeah, we know exactly how you did it. David

            1 Reply Last reply
            0
            • L Luis Alonso Ramos

              I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


              Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

              M Offline
              M Offline
              Matias Szulman
              wrote on last edited by
              #8

              I found out that the C# compiler only allows 2048 characters while writing a very long inline sql statement (later I found out that I could span it in several lines), but I try not to break any lines. I rather scroll than see the if condition all messed up

              1 Reply Last reply
              0
              • L Luis Alonso Ramos

                I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


                Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

                B Offline
                B Offline
                brianwelsch
                wrote on last edited by
                #9

                71 characters, because that's all the assemblers can handle. Though my C++/perl code is roughly what fits on the screen width, though it sometimes goes beyond that. BW


                All the chickens get it.
                And them singing canaries get it.
                Even strawberries get it.

                [

                Discovering BPI

                ](http://processflow.blogspot.com)

                1 Reply Last reply
                0
                • L Luis Alonso Ramos

                  I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


                  Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

                  S Offline
                  S Offline
                  stephen hazel
                  wrote on last edited by
                  #10

                  Luis Alonso Ramos wrote: So what is your line-length limit? any reasons? 80 columns. Period. Yes, I admit it. I'm a column nazi... I like to print out a page and still have room to scribble notes on the right about what I'm gonna change next in the code. Screens are almost as hi res as printers now adays. But I guess I'm just an old geezer cuz I NEED to print stuff out to fully grasp it... ...Steve

                  1 Reply Last reply
                  0
                  • L Luis Alonso Ramos

                    I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


                    Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

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

                    I used to try to put as much into a line as I could, and think of ways to do that, because it was interesting and felt cool. Nowadays, I'm more interested in writing human readable code, I tend to keep lines as short as I can, and break things up for clarity where-ever possible. The exception would be that I don't put using statements for a namespace if I'm only going to use one object out of it, I will scope it explicitly rather than pollute the local namespace ( being I am in C#, there is no global namespace ). Christian Graus - Microsoft MVP - C++

                    1 Reply Last reply
                    0
                    • L Luis Alonso Ramos

                      I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


                      Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

                      C Offline
                      C Offline
                      ColinDavies
                      wrote on last edited by
                      #12

                      To save paper I use to try for 80 on every line, and short variable names etc to save on ribbons. Things have changed now though. Regardz Colin J Davies The most LinkedIn CPian (that I know of anyhow) :-)

                      1 Reply Last reply
                      0
                      • L Luis Alonso Ramos

                        I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


                        Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

                        R Offline
                        R Offline
                        Roger Wright
                        wrote on last edited by
                        #13

                        Why limit it at all? As long as you remember to stick in a ';' once in a while, the compiler will sort it all out. Nobody will ever have to read it, after all.;P [Tip] You can save a lot of storage space by eliminating spaces in comments, too. No one will ever see them either. [/Tip] "...putting all your eggs in one basket along with your bowling ball and gym clothes only gets you scrambled eggs and an extra laundry day... " - Jeffry J. Brickley

                        1 Reply Last reply
                        0
                        • L Luis Alonso Ramos

                          I've always tried to keep my lines under 80 characters long, but recently, with all .NET identing (namespace, class, method, using, using and so on) it's becoming harder and harder. My original reason for 80 characters was so lines would not be broken when the code was printed, but I don't print code anymore. Also, with a bigger screen and all panels (solution explorer and so on) in auto-hide mode, I can easily fit some 110 characers (even with a 12 point font, bigger than average). I was thinking of imposing a new limit of 90 characters or 95 characters. So what is your line-length limit? any reasons? -- LuisR P.S. I seem to recall a similar thread some months ago. But I really didn't care then, now I do! :)


                          Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

                          O Offline
                          O Offline
                          ogrig
                          wrote on last edited by
                          #14

                          The shortest the better. And that extends naturally to the sizes of functions and source files. The more information you present at one time, the harder it is to understand it. Short lines are easier to debug and maintain (there are fewer risks of side effects). The fact that it's easier to maintain the same formatting across different setups (screen and/or paper) is an added bonus. By the way, this is one of the reasons why I tend to get violent when I see tabs in source code. Good communicators use short words, short phrases and short paragraphs. Take ads, all the good ones (the ones you, not me, like, remember and understand) are short. Search on Google for a science paper called "the magical number 7", or something similar. It explains some of the reasons why less is better. OGR

                          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