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. code comments

code comments

Scheduled Pinned Locked Moved The Lounge
question
65 Posts 27 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.
  • T TheGreatAndPowerfulOz

    I hate code comments that say what the code is doing but not why.

    /* check for null */
    if (someObj != null) {...}

    Really? Argh!

    #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

    A Offline
    A Offline
    A A J Rodriguez
    wrote on last edited by
    #61

    John Woods said it best, and the same applies for comments: > Always code as if the guy who ends up > maintaining your code will be a violent > psychopath who knows where you live.

    T 1 Reply Last reply
    0
    • A A A J Rodriguez

      John Woods said it best, and the same applies for comments: > Always code as if the guy who ends up > maintaining your code will be a violent > psychopath who knows where you live.

      T Offline
      T Offline
      TheGreatAndPowerfulOz
      wrote on last edited by
      #62

      :thumbsup::~ :(

      #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

      1 Reply Last reply
      0
      • K kalberts

        Maybe I misunderstand what you are saying: Fortran always handled arrays, at least from Fortran 2, with 1-based indexing. One fun detail: This 16 bit minimachine (that is, the size of a full height fridge) I was working with in the early 1980s used a 3-word (i.e. 48 bits) floating point format. The machine had an instruction called MIX3, which decremented the value in the accumulator and then multiplying by 3. MIX3 was tailor made for changing the "logicial" (1-based, 48 bits) Fortran index into a "physical" (0-based, 16-bit word) memory address. If you worry about tne "multiplication" being time consuming: It really was an addition of the accumulator, shifted one bit up, to itself, so it was faster than an ordinary add (which required an operand access). Yes, other languages were available - Pascal dates back to 1970, and honestly: From a language design point of view, it is far, far better than the entire C group of languages. (However, it failed in system programming ascpects; a standard Pascal program resided in a single source file. If the standard had included modularization concepts, it should have beaten C to the ground...). What kept Fortran up for so long was "the same old story": Legacy code. Fortran IV was The Standard for offering open source code (open source did NOT start with Linux!). ACM offered a huge collection of several thousand Fortran IV functions for every imaginable mathematical, engineering, or otherwise scientific, operation. I even worked on a machine whose operating system was written in Fortran (in the days when it was considered 'impossible' to write an OS in anything but assembler). I think of old Fortran with no regrets or complaints, and enjoy all those jokes and ways of speech that came out of Fortran. Like "You can program Fortran in any programming language" (to refer to unstructured, bad code). Or "God is real, unless explictly declared integer". And then the beauty from a Xerox Fortran programming manual: "The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change".

        C Offline
        C Offline
        Clifford Nelson
        wrote on last edited by
        #63

        Sorry I was not clear, I should have said matrix operations. Yes they had multidimensional arrays, but not matrix operations. they did add it later. The reason they did was more so that FORTRAN could be better applied to multiprocessor architectures.

        K 1 Reply Last reply
        0
        • C Clifford Nelson

          Sorry I was not clear, I should have said matrix operations. Yes they had multidimensional arrays, but not matrix operations. they did add it later. The reason they did was more so that FORTRAN could be better applied to multiprocessor architectures.

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

          OK, then I am with you - but for the full complement of matrix operations to be available, you have to move into our millenium :-). You had all the matrix you could think of in the open source ACM libraries, in Fortran IV syntax, from the 1970s, so you didn't have to write the functions yourself (if you were, or knew someone who was, a member of the ACM) - but the syntax is of course a lot sweeter when matrix operations are first class language elements. Regarding parallell operations: With the Cray supercomputer, you had library functions for directly utilizing on the Cray vector registers. However, the Cray Fortran compiler was well known for vectorizing even scalar operations: If your program made, say, ten independent scalar multiplications with no ordering requirements, the compiler might collect them and set it up as one single vector multiply. In principle, this is not much more than reordering independent operations for better use of registers in a single-stream CPU, but Cray took it to extremes.

          C 1 Reply Last reply
          0
          • K kalberts

            OK, then I am with you - but for the full complement of matrix operations to be available, you have to move into our millenium :-). You had all the matrix you could think of in the open source ACM libraries, in Fortran IV syntax, from the 1970s, so you didn't have to write the functions yourself (if you were, or knew someone who was, a member of the ACM) - but the syntax is of course a lot sweeter when matrix operations are first class language elements. Regarding parallell operations: With the Cray supercomputer, you had library functions for directly utilizing on the Cray vector registers. However, the Cray Fortran compiler was well known for vectorizing even scalar operations: If your program made, say, ten independent scalar multiplications with no ordering requirements, the compiler might collect them and set it up as one single vector multiply. In principle, this is not much more than reordering independent operations for better use of registers in a single-stream CPU, but Cray took it to extremes.

            C Offline
            C Offline
            Clifford Nelson
            wrote on last edited by
            #65

            Yes I know they did update it years ago. My complaint is that it should have been put into FORTRAN 77. Given that it was originally the programming language for science/engineering, and I was using it in a scientific application back when FORTRAN 77 was released, would have made a lot of sense in improving its ability to handle physics and math problems instead of having to roll your own functions, or having to include the ACM libraries. It is understandable that the early version had complex numbers, and that most modern languages like C, C++, C#, etc. do not even have special functionality of complex numbers. That so much work has been put into FORTRAN compliers to better support parallel operations also makes a lot of sense since quite often scientific calculations can be excessive compute bound.

            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