> Prima variantă merge oricând AFAIK. De ce să mai folosești și pragma > dacă nu e portabil? From [1]: "Using #pragma once instead of include guards will typically increase compilation speed since it is a higher-level mechanism; the compiler itself can compare filenames or inodes without having to invoke the C preprocessor to scan the header for #ifndef and #endif.
Some compilers such as GCC and Clang include special speedup code to recognize and optimize the handling of include guards, and thus little or no speedup benefit is obtained from the use of #pragma once." From [2]: "In order for #include guards to work properly, each guard must test and conditionally set a different preprocessor macro. Therefore, a project using #include guards must work out a coherent naming scheme for its include guards, and make sure its scheme doesn't conflict with that of any third-party headers it uses, or with the names of any globally visible macros. For this reason, many C and C++ implementations provide the non-standard directive #pragma once." Practic, sunt atat argumente pro, cat si contra si depinde de ce preferi sa folosesti. Probabil se folosesc impreuna pentru ca, in cazul in care compilatorul tine cont de #pragma once si poate avea ca rezultat o viteza de compilare mai mare, atunci se foloseste #pragma. Cel putin eu asta am inteles din cele 2 articole. -- Silviu Popescu [1]https://secure.wikimedia.org/wikipedia/en/wiki/Pragma_once [2]https://secure.wikimedia.org/wikipedia/en/wiki/Include_guard _______________________________________________ http://lists.rosedu.org/cgi-bin/mailman/listinfo/rosedu-general
