Thread: Naming Scheme...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    31

    Naming Scheme...

    The default template for a windows program that Dev-C++ gives me has the window class name by default be "szClassName". The winprog.net one uses "g_szClassName" for one and "g_hbmBall" as a name for an HBITMAP. I know it's ultimately arbitrary, but what's the pattern, exactly?

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Is the stuff preceded by g_ global?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    31
    Why yes it is. How about the sz?

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    A string terminated by zero (null).
    http://en.wikipedia.org/wiki/Hungarian_notation


    [I'm not a fan.]
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    Feb 2005
    Posts
    31
    Awesome, thanks a bunch!

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Hungarian notation can be handy, more so in C than C++ (IMO).

    I can have many variables with the same name but differing types. This is so I know where the are used and have to be freed.

    For example, if I have a device context (DC) for drawing say a graph.

    hdcGraph //the handle device contex I am using
    hbmpGraph //the handle to the compatible BMP i have created
    hfntGraph //the handle to the font the graph uses
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    My example of why I don't like them is this: u_int16_t. What the hell is the type???

    [You can search the forum for my previous reply.]
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Variable naming
    By gin in forum C++ Programming
    Replies: 5
    Last Post: 07-12-2008, 04:15 PM
  2. naming conventions?
    By Tox|k in forum C Programming
    Replies: 44
    Last Post: 05-26-2008, 08:29 AM
  3. Scheme
    By YankeePride13 in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-18-2005, 04:16 AM
  4. Post your IDE scheme!
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 05-09-2005, 05:47 AM
  5. Naming variables, functions...
    By Ariod in forum Tech Board
    Replies: 9
    Last Post: 08-19-2003, 12:17 PM