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

Tabs

Scheduled Pinned Locked Moved The Lounge
javascriptvisual-studiocomquestion
44 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.
  • K kalberts

    Then you may know the one-operand infinite loop of 1108 - it didn't even take the whole of an instruction to create an infinite loop. I don't remember all the details of Univac addressing formats, so this description may not be a 100% exact: You could set a bit in the address field for one extra level of indirection - in the location given, you won't find the data, but the address of the data. There you might find another address with the indirection bit set. Any levels of indirection was allowed, all executed as part of the operand value decoding. If you set up one such indirection pointing to itself, you had a single operand version of an unconditional jump to itself. Only that while decoding that indirection, the CPU didn't respond to interrupts. A single-instruction loop could be broken, e.g. by the system operator. The single-operand loop totally locked up the entire CPU; it had to be rebooted - which, for a Univac 1100 system was something more than Ctrl-Alt-Del :-). Most graduate, "responsible" students were aware of this quick way of taking the system down, but everyone tried to keep it secret to the younger, and potentially less responsible, student who might want to "try it out for fun". The U had an old 1108 and a new 1110. I don't think the 1110 went down many times (if at all) from one-operand infinite loops. It could be that Univac had made it interruptible on the 1110, or it could be that my generation of students never did assembly programming on the Univac; we were on our way into the OO world (beliving that Simula would forever be The superhero of OO languages...). Very few of my fellow students ever saw the U1100 instruction set and addressing modes at all.

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

    Ha ha, forgot about that:

          J          \*$   . Goodbye, World!
    
    1 Reply Last reply
    0
    • W W Balboos GHB

      Richard MacCutchan wrote:

      Only in Java. C,C++ and C# it goes on the next line under the "i" character

      I was speaking in terms of coding professionals and should have made that clearer!

      Ravings en masse^

      "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

      "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

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

      W∴ Balboos, GHB wrote:

      coding professionals

      All of whom adhere to their own personal standards.

      1 Reply Last reply
      0
      • W W Balboos GHB

        I think I fixed the (accidental) double indent. As for the use of labels - no compiler differences to worry about if you keep it all in comment form. Maybe it's just me, but have a consistent convention across all of the coding languages is rather helpful at my age.

        Ravings en masse^

        "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

        "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

        K Offline
        K Offline
        kalberts
        wrote on last edited by
        #30

        Certainly a valid argument - in particular when that is your only choice (but of course: Comment syntax varies across languages, and some languages don't even have an explicit block terminator to which you can affix your comment; you have to create a separate comment line, and must explain it by eg. "// end of if (condition)" so that it doesn't look as a commented-out if-statement. And you don't get the compiler check. But if you can't get that, anyway, you certainly haven't lost anything. I fully support you commenting style here. Yet I keep wishing that we had compiler support for it, and a simpler and cleaner syntax. ... Bemoaning what you can't get, begets nothing. Yet, moaning is a sort of self-comforting in hard times.

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          Well, we get enough "articles" submitted with ten lines of code spread across two pages that it must be true! :laugh:

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #31

          We get paid for article length? :omg:

          GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

          1 Reply Last reply
          0
          • L Lost User

            The 8 space idea was around from the early days of Unix, and the only the terminals were basic teletypes (electric typewriters). I Have never understood why anyone thought that was a good idea on a device that generally could only print 80 characters across the page.

            S Offline
            S Offline
            Stefan_Lang
            wrote on last edited by
            #32

            That at least explains why in FORTRAN names were limited to 6 chars (initally): not much room left when you have 8 chars per indentation level! :doh:

            GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

            1 Reply Last reply
            0
            • W W Balboos GHB

              lw@zi wrote:

              I was wondering why they were talking about tab = 8 spaces.

              What do you mean "we" ? For a coding application I set tab at four, or even two. It's a bit font-dependent. As for your code sample, all eyes are different, but for your 4-space tab I'd make it:

              if (true) {
              // Indent of 1 tab = 4 spaces
              if (false) {
              // some thing here
              } // if(false)
              } // if(true)

              I particularly draw your attention to two three conventions:

              • Opening brace on same line as conditional
              • Closing brace under begfinning of its conditional
              • Comment containing matching conditional clearly identifies the end

              The labling of the closing brace is invaluable when you look at the stuff some day further along in history and need to see what's what very quickly (or at least more quickly).

              Ravings en masse^

              "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

              "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

              S Offline
              S Offline
              Stefan_Lang
              wrote on last edited by
              #33

              Quote:

              Opening brace on same line as conditional

              I used to prefer that style, but as I keep introducing more and more self-explanatory variable names, conditions tend to get long, and multiline conditions are not uncommon in my code. And then this happens:

              if (my_condition && my_other_condition ||
              use_other_condition_flag && other_condition) {
              do_something();
              }

              and suddenly the egyptian style didn't seem to be so great anymore! Compare to this:

              if (my_condition && my_other_condition ||
              use_other_condition_flag && other_condition)
              {
              do_something();
              }

              Here the actual if code block is much easier to recognize!

              GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

              W 1 Reply Last reply
              0
              • S Stefan_Lang

                Quote:

                Opening brace on same line as conditional

                I used to prefer that style, but as I keep introducing more and more self-explanatory variable names, conditions tend to get long, and multiline conditions are not uncommon in my code. And then this happens:

                if (my_condition && my_other_condition ||
                use_other_condition_flag && other_condition) {
                do_something();
                }

                and suddenly the egyptian style didn't seem to be so great anymore! Compare to this:

                if (my_condition && my_other_condition ||
                use_other_condition_flag && other_condition)
                {
                do_something();
                }

                Here the actual if code block is much easier to recognize!

                GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                W Offline
                W Offline
                W Balboos GHB
                wrote on last edited by
                #34

                Except I would have indented the do_something(); It's really all personal eye-candy - I really don't like all of (almost) empty lines breaking things ups - just indented blocks do adequately. For really long conditionals (sometimes it happens) I actually will "format" them, themselves, so as to create a more visually orderly condition - somewhat as you did although possibly more than one per line if they're not complex. Most important of all: consistency to aid in updates, help track bugs, and avoid bugs in the first place. The last seems to always somehow be theoretical.

                Ravings en masse^

                "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                1 Reply Last reply
                0
                • D dan sh

                  Taking off from the tabs vs spaces post few threads below, I was wondering why they were talking about tab = 8 spaces. Does it not make the code unreadable as it is too spaced out? When tab is set to 8 spaces: if (true) { // Indent of 1 tab = 8 spaces if (true) { // some thing here } } When tab is set to 4 spaces: if (true) { // Indent of 1 tab = 4 spaces if (true) { // some thing here } }

                  "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

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

                  When code was a bunch of if/gotos, you never indented more than 1 level! Probably goes back to basic style guides for non-code writing as well.

                  1 Reply Last reply
                  0
                  • K kalberts

                    Dan Neely wrote:

                    Find a plugin that can be configured to have exceptions for makefiles and anything else that's tool generated?

                    We didn't have to find another tool, just to reconfigure the one we had. But the first decision, to deny tabs from anything that consisted of plain text, has to be revised.

                    F Offline
                    F Offline
                    Fever905
                    wrote on last edited by
                    #36

                    Did you guys all see the episode of Silicon Valley where the guy breaks up with a girl because she uses spaces to indent her code instead of tabs? Like what would anyone use spaces vs tabs?

                    1 Reply Last reply
                    0
                    • D dan sh

                      Taking off from the tabs vs spaces post few threads below, I was wondering why they were talking about tab = 8 spaces. Does it not make the code unreadable as it is too spaced out? When tab is set to 8 spaces: if (true) { // Indent of 1 tab = 8 spaces if (true) { // some thing here } } When tab is set to 4 spaces: if (true) { // Indent of 1 tab = 4 spaces if (true) { // some thing here } }

                      "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                      A Offline
                      A Offline
                      agolddog
                      wrote on last edited by
                      #37

                      I think that's kind of the point of the pro-tab crowd: you can set your preferences to whatever works for you. BTW, I agree that 8 is too much.

                      1 Reply Last reply
                      0
                      • L Lost User

                        The 8 space idea was around from the early days of Unix, and the only the terminals were basic teletypes (electric typewriters). I Have never understood why anyone thought that was a good idea on a device that generally could only print 80 characters across the page.

                        K Offline
                        K Offline
                        KLSmith
                        wrote on last edited by
                        #38

                        The 8 space tab was around long before UNIX. Manual typewriters had a tab key. It was a means to quickly jump across the page and to line up columns. So for a manual typewriter, the 8 space tab made more sense than a 4 space one. Today, it is like using the floppy icon for the save function. Historically it makes sense, but it is rather obsolete.

                        1 Reply Last reply
                        0
                        • D dan sh

                          So, if you get paid by lines, do you also get paid for empty lines?

                          "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                          S Offline
                          S Offline
                          Skip Sailors
                          wrote on last edited by
                          #39

                          No, count semicolons.

                          1 Reply Last reply
                          0
                          • D dan sh

                            Taking off from the tabs vs spaces post few threads below, I was wondering why they were talking about tab = 8 spaces. Does it not make the code unreadable as it is too spaced out? When tab is set to 8 spaces: if (true) { // Indent of 1 tab = 8 spaces if (true) { // some thing here } } When tab is set to 4 spaces: if (true) { // Indent of 1 tab = 4 spaces if (true) { // some thing here } }

                            "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                            B Offline
                            B Offline
                            Bitbeisser
                            wrote on last edited by
                            #40

                            Since "way back", I have always used a 4 spaces tab setting on all C (and Perl, C++, etc) languages, 8 spaces tabs or no tabs on everything else. And so did pretty much everyone else in those days.

                            1 Reply Last reply
                            0
                            • D dan sh

                              Taking off from the tabs vs spaces post few threads below, I was wondering why they were talking about tab = 8 spaces. Does it not make the code unreadable as it is too spaced out? When tab is set to 8 spaces: if (true) { // Indent of 1 tab = 8 spaces if (true) { // some thing here } } When tab is set to 4 spaces: if (true) { // Indent of 1 tab = 4 spaces if (true) { // some thing here } }

                              "It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]

                              N Offline
                              N Offline
                              Navanax
                              wrote on last edited by
                              #41

                              I believe the convention goes back typewriters, which may have picked it up from typesetting. Approximately 80 characters per typewritten line on a standard sheet of paper. If you break that into 10 columns (so you can make tables), you start a new column every 8 characters. So when typing a table, you would enter something, hit the tab key which would take you over the "remaining" amount of the 8 characters, then type your next column. If you just hit the tab key, you went over 8 characters to leave that entry in the column blank. Come on people - I'm not the only "old fart" around here. Surely I'm not the only one that learned to type on a typewriter rather than a teletype or PC keyboard!

                              1 Reply Last reply
                              0
                              • L Lost User

                                The 8 space idea was around from the early days of Unix, and the only the terminals were basic teletypes (electric typewriters). I Have never understood why anyone thought that was a good idea on a device that generally could only print 80 characters across the page.

                                K Offline
                                K Offline
                                Kirk 10389821
                                wrote on last edited by
                                #42

                                Okay, TABS existed because Word Processing was text based, and there were no common spreadsheets. The ONLY way to create stuff that LINED UP properly was to use tabs. Not as horrible with a FIXED font, but if you were using a regular font. I DARE you to try to line things up with spaces! And in this environment, 8 spaces was EXACTLY 10% of the row, which made the math easy to deal with. We used this to HAND TYPE The student Graduation Lists in High School. And amazingly enough, we had paper terminals, but created an adapter to connect a Brother typewriter and "print" to it like a terminal, and got the text to line up and look nice! (We were working on a PDP-11 and our paper terminals were dot-matrix, 300 baud, unidirectional LA36). FINALLY, a normal typewriter (where this all started) had the same thing, but I think the fancy ones would let you set the TABSTOPS (like you can in Word). Getting 4 columns of names out took planning (Some kids had LONG names, LOL). The NEXT level of Word Processing looked like Markdown does today! There was NO WYSIWYG.

                                1 Reply Last reply
                                0
                                • Greg UtasG Greg Utas

                                  Richard MacCutchan wrote:

                                  C,C++ and C# it goes on the next line under the "i" character.

                                  At least for C++--the others are irrelevant dreck--you are correct, and people should harken to someone so venerable. :)

                                  F Offline
                                  F Offline
                                  FormerBIOSGuy
                                  wrote on last edited by
                                  #43

                                  If you use a laptop or desktop computer made in the past few years, your operating system likely relied on a UEFI BIOS written almost entirely in "C" to detect and program the hardware. I would hardly call that irrelevant dreck! ;)

                                  FormerBIOSGuy

                                  Greg UtasG 1 Reply Last reply
                                  0
                                  • F FormerBIOSGuy

                                    If you use a laptop or desktop computer made in the past few years, your operating system likely relied on a UEFI BIOS written almost entirely in "C" to detect and program the hardware. I would hardly call that irrelevant dreck! ;)

                                    FormerBIOSGuy

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

                                    They're still dreck, but people somehow manage to overcome this and build useful things with them. :laugh:

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

                                    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