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
c++questionannouncement
25 Posts 15 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.
  • E Offline
    E Offline
    Emanuele 0
    wrote on last edited by
    #1

    How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

    C N V D T 10 Replies Last reply
    0
    • E Emanuele 0

      How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

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

      Never start with anything like this. Usually a few #includes and a class declaration. WITHIN the class I work hard to comment everything, but nothng like the above. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

      N 1 Reply Last reply
      0
      • N Nish Nishant

        Christian Graus wrote: Never start with anything like this. Usually a few #includes and a class declaration LOL That is the clearest indication that CG has not worked for a CMM level 5 company yet... Nish

        My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

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

        Nish [BusterBoy] wrote: a CMM level 5 compan What's that ? Oh, and please go and look at my question in the C# forum :-) Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

        K D 2 Replies Last reply
        0
        • E Emanuele 0

          How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #4

          Most companies have pre-defined comment headers. Mine does not, not yet. here we put whatever we want to. In my case often that comes to nothing Nish

          My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

          1 Reply Last reply
          0
          • C Christian Graus

            Never start with anything like this. Usually a few #includes and a class declaration. WITHIN the class I work hard to comment everything, but nothng like the above. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #5

            Christian Graus wrote: Never start with anything like this. Usually a few #includes and a class declaration LOL That is the clearest indication that CG has not worked for a CMM level 5 company yet... Nish

            My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

            C P 2 Replies Last reply
            0
            • N Nish Nishant

              Christian Graus wrote: Never start with anything like this. Usually a few #includes and a class declaration LOL That is the clearest indication that CG has not worked for a CMM level 5 company yet... Nish

              My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

              P Offline
              P Offline
              peterchen
              wrote on last edited by
              #6

              CMM, according to babylon: Channel Mode Modify computerized measurement machine Capability Maturity Model Channel Mode Modify Workflow Template (SAP) now what?

              1 Reply Last reply
              0
              • C Christian Graus

                Nish [BusterBoy] wrote: a CMM level 5 compan What's that ? Oh, and please go and look at my question in the C# forum :-) Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

                K Offline
                K Offline
                Kannan Kalyanaraman
                wrote on last edited by
                #7

                Christian Graus wrote: What's that ? That would be "Capability Maturity Model" something on the lines of ISO Certifications for quality. If you are in CMM Level 5 company, it would mean for writing three lines of code(i mean modifying an existing application and introducing new code) it would require one week of documentation. Cheers Kannan

                C 1 Reply Last reply
                0
                • K Kannan Kalyanaraman

                  Christian Graus wrote: What's that ? That would be "Capability Maturity Model" something on the lines of ISO Certifications for quality. If you are in CMM Level 5 company, it would mean for writing three lines of code(i mean modifying an existing application and introducing new code) it would require one week of documentation. Cheers Kannan

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

                  Confirming my suspicion that I want nothing to do with it :-) Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

                  1 Reply Last reply
                  0
                  • C Christian Graus

                    Nish [BusterBoy] wrote: a CMM level 5 compan What's that ? Oh, and please go and look at my question in the C# forum :-) Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

                    D Offline
                    D Offline
                    Daniel Turini
                    wrote on last edited by
                    #9

                    CMM originally was created with an objective in mind: assess if you can give a project to a company and have it done right. After some years, people began using it to run their business, so they can be sure they are "CMM level 5". Let's see two actual samples of CMM in real world: Situation 1: Can you give a complex OS to a small company run by two nerds, running a CMM level 1 (worst level) company, like IBM did with MS ? Surely you won't have the work done. Example 2: If one person alone can code a small although complete UNIX kernel for your embeddedd application, like Linus Torvalds did. So, my conclusion is that by CMM we would never had: DOS, Windows Apple II, Macintosh ICQ Netscape, Internet Explorer CVS and so on... and by CMM all software in the world should be done by IBM. Right ? Crivo Automated Credit Assessment

                    N 1 Reply Last reply
                    0
                    • E Emanuele 0

                      How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

                      V Offline
                      V Offline
                      Vimal Earnest
                      wrote on last edited by
                      #10

                      i start with something similar ( our coding standard insists so ) /*******************************.FILE_HEADER.*************** * .File: .xxxxx.c * .Version: .0.0 * .Project Code: .PROJECT * .Author: .Vimal * .Created on: .15 Mar 2002 ************************************************************ * .Summary: * .Note: * * .Revision History: bug fixes and optimizations * ***********************************************************/

                      N 1 Reply Last reply
                      0
                      • D Daniel Turini

                        CMM originally was created with an objective in mind: assess if you can give a project to a company and have it done right. After some years, people began using it to run their business, so they can be sure they are "CMM level 5". Let's see two actual samples of CMM in real world: Situation 1: Can you give a complex OS to a small company run by two nerds, running a CMM level 1 (worst level) company, like IBM did with MS ? Surely you won't have the work done. Example 2: If one person alone can code a small although complete UNIX kernel for your embeddedd application, like Linus Torvalds did. So, my conclusion is that by CMM we would never had: DOS, Windows Apple II, Macintosh ICQ Netscape, Internet Explorer CVS and so on... and by CMM all software in the world should be done by IBM. Right ? Crivo Automated Credit Assessment

                        N Offline
                        N Offline
                        Nish Nishant
                        wrote on last edited by
                        #11

                        Very neat way to portray how CMM sucks! Very good!!! :-) Nish p.s. I don't work for a CMM company by the way. Whew!!!

                        My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

                        1 Reply Last reply
                        0
                        • V Vimal Earnest

                          i start with something similar ( our coding standard insists so ) /*******************************.FILE_HEADER.*************** * .File: .xxxxx.c * .Version: .0.0 * .Project Code: .PROJECT * .Author: .Vimal * .Created on: .15 Mar 2002 ************************************************************ * .Summary: * .Note: * * .Revision History: bug fixes and optimizations * ***********************************************************/

                          N Offline
                          N Offline
                          Nish Nishant
                          wrote on last edited by
                          #12

                          I bet you work for a CMM certified company :-) Nish

                          My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

                          V 1 Reply Last reply
                          0
                          • N Nish Nishant

                            I bet you work for a CMM certified company :-) Nish

                            My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

                            V Offline
                            V Offline
                            Vimal Earnest
                            wrote on last edited by
                            #13

                            Yes I do. Nish, I work at Nest, a CMM level 5 company in trivandrum. :)

                            N 1 Reply Last reply
                            0
                            • V Vimal Earnest

                              Yes I do. Nish, I work at Nest, a CMM level 5 company in trivandrum. :)

                              N Offline
                              N Offline
                              Nish Nishant
                              wrote on last edited by
                              #14

                              Vimal Earnest wrote: in trivandrum Wow! A fellow Trivandrumite :-) Cool! Nish

                              My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

                              K 1 Reply Last reply
                              0
                              • E Emanuele 0

                                How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

                                D Offline
                                D Offline
                                David Wulff
                                wrote on last edited by
                                #15

                                I just go in for the simple approach which easily identifies the files as one of ours...

                                /*------------------------------------------------------------------*/
                                /* Filename: Filename.cpp */
                                /* Desc: A quick description of the purpose of this file. */
                                /* */
                                /* Date: March 2002 */
                                /* Author(s): David Wulff */
                                /* */
                                /* This file is Copyright 2002 Battleaxe Software Limited, and may */
                                /* .. not be used or redistributed without license. */
                                /* */
                                /* License: http://www.battleaxesoftware.com/license/ */
                                /*------------------------------------------------------------------*/

                                If there are any important revisions made to a file that deserve their own comments, this would be added as a normal comment block underneath the heading or with the appropriate section of code. However (and this one *is* a touchy subject with devlopers), we use comment blocks for each function...

                                /*------------------------------------------------------------------*/
                                /* processInput */
                                /* Process the input events. Called at each frame start. */
                                /*------------------------------------------------------------------*/

                                We even use these with obvious things like constructors as it makes it easy to tell the tsrta of anew function when you are scrolling quickly through a large file. ________________ David Wulff http://www.davidwulff.co.uk Sonork ID: 100.9977 Dave …

                                1 Reply Last reply
                                0
                                • E Emanuele 0

                                  How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

                                  T Offline
                                  T Offline
                                  Todd Smith
                                  wrote on last edited by
                                  #16

                                  I use a VC++ add-in to generate .cpp/.h files. So every file has the same format that looks something like

                                  #ifndef _REGISTRY_H_
                                  #define _REGISTRY_H_
                                  //****************************************************************************
                                  //**
                                  //** Registry.h
                                  //**
                                  //** Author : Todd Smith
                                  //** Date : Mon Dec 10 10:21:58 2001
                                  //** Notes : CMM lvl -1 compliant header
                                  //**
                                  //** $Id: Registry.h,v 1.5 2002/01/04 21:20:23 todd Exp $
                                  //**
                                  //****************************************************************************
                                  //============================================================================
                                  // INTERFACE REQUIRED HEADERS
                                  //============================================================================

                                  Todd Smith CPUA 0x007 ... shaken not stirred

                                  L 1 Reply Last reply
                                  0
                                  • E Emanuele 0

                                    How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

                                    C Offline
                                    C Offline
                                    Chris Hafey
                                    wrote on last edited by
                                    #17

                                    It seems redundant to record the filename, author, date, version and revision history in the file itself when you are using a source control system. We don't have any kind of header on our source code, just #includes. Oh yeah we are ISO-9001 certified. Chris Hafey

                                    1 Reply Last reply
                                    0
                                    • N Nish Nishant

                                      Vimal Earnest wrote: in trivandrum Wow! A fellow Trivandrumite :-) Cool! Nish

                                      My miniputt high is now 29 I do not think I can improve on that My temperament won't hold www.busterboy.org

                                      K Offline
                                      K Offline
                                      Kannan Kalyanaraman
                                      wrote on last edited by
                                      #18

                                      Nish, I was just about to say, he would be working just a couple of blocks from your work place :-). Cheers Kannan

                                      1 Reply Last reply
                                      0
                                      • E Emanuele 0

                                        How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

                                        N Offline
                                        N Offline
                                        Navin
                                        wrote on last edited by
                                        #19

                                        Most our files start out with a header similar to what you have... except it's specially formatted to work with our version control system (PVCS) so that it automatically gets updated with the revision notes we type in. Functions usually have a couple lines explaining what they do (if not trivial), and what the parameters do (if not obvious.) For other blocks of code, I tend to comment WHY this code exists. That seems to be much more useful than just commenting WHAT the code does - that is often self-evident. For instance, you might find a comment like this: // Delete these registry entries becuase the API doesn't do it instead of // Delete HKEY_LOCAL_MACHINE/Software/App/Key :) Winning isn't everything, but then, losing is nothing.

                                        1 Reply Last reply
                                        0
                                        • E Emanuele 0

                                          How do you begin your code? Do you write comments at the beginning that tell who is the developer, the date, the name of the module?? I usually begin like this: ///////////////////////////// // fileName.cpp //Date: 09/04/2001 // Author: emanuele delbono // Version: 1.0 // Revision history // Date - Author // Comments: ////////////////////// And you?? Do you insert some sort of joke?? :-))

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

                                          I like Paul DiLascia's header. He often has something like this in it : // If this code works it was written by Paul DiLascia. // If not then I don't know who wrote it.

                                          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