Function Declaration in Interface File :: MFC

Status
Not open for further replies.
Hi.

Regarding C++ windows programming, is it a convention to include both data type and variables names for function parameters in the declaration file?

For example:

Code:
class MyFrame : public CFrameWnd
{
public:
   MyFrame();
   functionA(int &var, char &str);
   
protected:
   afx_msg OnPaint();
   afx_msg OnLButtonDown(UINT nChar, UINT nRep, UINT nFlags);

// afx_msg OnLButtonDown(UINT, UINT, UINT);
...
private:
...
};

I am used to not including anything more than what is necessary.

Kuphryn
 

Tychom

Ars Tribunus Militum
2,391
Subscriptor
Well as far as intellisense goes, I'm sure the popups that occur with function information when your typing in parameters go by the declaration as opposed to the definition. So with meaningful names in the declaration you'll be helped later on.

A matter of taste I suppose, but atleast you can read just the header file alone and get extra information (yes, they should be documented anyway :) ).
 
Okay. Thanks.

I am seeing something interesting about program philosophy especially C++. I remember when I first began learning C++ last fall. Every book I read, including Gaddis and Deitel&Deitel, prefer to "hide" the variable name in the declaration file. Now with MFC, I find that Microsoft is more into *convention* and *easy user*. MFC is a well organized "package." For example, the member variables all start with "m" and "m_p."

Kuphryn
 

Nothinman

Ars Tribunus Angusticlavius
8,783
I remember when I first began learning C++ last fall. Every book I read, including Gaddis and Deitel&Deitel, prefer to "hide" the variable name in the declaration file. Now with MFC, I find that Microsoft is more into *convention* and *easy user*. MFC is a well organized "package." For example, the member variables all start with "m" and "m_p."

'hiding' variable names in the header files seems really dumb, I can't see it serving a purpose besides making the functions harder to use.

And I really dislike MS' use of hungarian notation for variable names, but there's already a thread on that here =)
 
Status
Not open for further replies.