|
From: Vlada D. <dj...@im...> - 2003-06-16 12:30:20
|
Thanks for help. Good to know that. ----- Original Message ----- From: "Ioannis Vranos" <iv...@em...> To: "'DevC++ help'" <dev...@li...> Sent: Monday, June 16, 2003 1:09 PM Subject: RE: [Dev-C++] #pragma directive > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Vlada Djurovic > > Sent: Monday, June 16, 2003 11:52 AM > > To: 'DevC++ help' > > Subject: [Dev-C++] #pragma directive > > > > > > In the book I'm currently reading, #pragma once directive is > > used a lot to > > make sure that no header files are included more than once. > > When I compile > > the program, I get warnings " #pragma once is obsolete". The book is > > published this year, so I don't think it's too old. > > I found another way for doing the same thing in Bruce Eckel's > > "Thinking in > > C++", like this: > > > #pragmas are compiler dependend commands which are not portable. The > standard says that when a #pragma directive is not recognised by the > compiler it is ignored. So #pragma once is a directive recognised by MS > compilers to include the header file only once. > > > On the other hand the inclusion guard mechanism you are using below is > portable and is what you should use (if you want your code to be portable). > > > > > > > #ifndef FLAG > > #define FLAG > > #includefoo.h ///include needed headers > > ------------- > > #endif > > > > Which way is better in your opinion? Or do you recommend > > something else? > > Thanks. > > ------------ > > Vlada > > > > > > Ioannis Vranos > > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL 1: http://run.to/noicys > * Alternative URL 2: http://www.noicys.cjb.net > > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: eBay > Great deals on office technology -- on eBay now! Click here: > http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |