Convention in C/C++

This is a discussion on Convention in C/C++ within the C++ Programming forums, part of the General Programming Boards category; I despise hungarian (for reasons that have been well-covered by salem and others), but I do use an 'm_' prefix ...

  1. #16
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    I despise hungarian (for reasons that have been well-covered by salem and others), but I do use an 'm_' prefix for members. This allows for easy differentiation of parameters and members, esp in mutators.
    Code:
    class X
    {
    public:
        void SetY(int y)
        {
             m_y = y;
        }
    private:
        int m_y;
    };
    it's basically shorthand for this->y and it's not actually hungarian, btw.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  2. #17
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Sorry for the long reply. Been busy programming for awhile. Thanks to all of you. I see that many programmers did what I do. I also only use Hungarian Convention for member variables (m_...), pointers (p...), and constants (c_...). And here I thought that I will get a bad karma if I didn't use a right convention.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. calling convention stdcalll and cdecl call
    By George2 in forum Windows Programming
    Replies: 1
    Last Post: 07-17-2008, 03:26 AM
  2. What do you think of this C++ naming convention?
    By cnsr in forum C++ Programming
    Replies: 10
    Last Post: 01-07-2004, 07:51 PM
  3. Replies: 2
    Last Post: 01-04-2003, 12:16 AM
  4. VB Calling Convention?!
    By minime6696 in forum Windows Programming
    Replies: 6
    Last Post: 03-27-2002, 03:39 PM
  5. Maya Convention
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 03-01-2002, 10:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21