To avoid multiple includes of a header file, one of my friend suggested the following way
#ifndef _INTERFACEMESSAGE_HPP
#define _INTERFACEMESSAGE_HPP
class CInterfaceMessage
{
/ /Declaration of class goes here
//i.e declaration of member variables and methods
private:
int m_nCount;
CString m_cStrMessage;
public:
CString foo(int);
}
#endif
where _INTERFACEMESSAGE_HPP is just an identifier
but when i declare a class using visual studio 2005 IDE I get a statement as #pragma once at the starting of the class definition when i took the help of msdn to find the purpose of #pragma once it gave me the following explanation
"Specifies that the file will be included (opened) only once by the compiler when compiling a source code file. "
Someone please tell which is the right approach?, if both are correct then what is the difference? is one approach is better than the other?
: capable of producing desired results especially without waste (as of time or energy)
"We are working to make the process more efficient." "Over time, she will become more efficient." Used with adverbs: "These machines are very efficient."
The words effective and efficient both mean "capable of producing a result," but there is an important difference. Effective means "producing a result that is wanted". Efficient means "capable of producing desired results without wasting materials, time, or energy".
The definition of efficient is being productive with minimal effort. An example of efficient is a car that gets 60 miles to a gallon of gas. YourDictionary. Making good, thorough, or careful use of resources; not consuming extra. Especially, making good use of time or energy.
gcc has pragma once as deprecated. You should use the standard include guards. All pragma directives are by definition implementation defined. So, if you want portability, don't use them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With