Quote:
Originally Posted by phuc_tran
Beside using this directive (#pragma) , in C++ is there any other way which has the same as function of #pragma
|
It depends. There isn't just one #pragma command, there are several commands with the #pragma directive (follow the link I included previously). Many, if not most, are specific to the compiler, OS, or machine that they're designed for.
For the example I cited above, #pragma once, there is an ANSI equivalent listed on page 455 of the book.
Code:
#ifndef BOX_H
#define BOX_H
// Header file code here
//
#endif
For the others, I imagine there are some cross-platform compatible equivalents, but due to the nature of #pragma, it has no universal equivalent.