#pragma push and pop (actually it's pragma warning push(...) and pop(...) )

Lucas Vogel lvogel@exponent.com
Tue, 5 Sep 2000 13:31:59 -0700


You're right, I did ask the wrong question. The '#pragma warning
[push][pop]...' directive actually sounds useful, at least the MS one seems
to be. 
	Unless there is a different (or even standard) way to produce the
same results I kind of think the gcc reason that you mentioned doesn't seem
to be a very strong argument. I border on not knowing what I'm talking about
here, but it seems as though the implementation of such a keyword/macro
wouldn't be such a hard thing to do, and would even be useful to some
extent. I have compiled many a program that spits out all kinds of different
warnings; it would be nice if those warnings could be hidden from view if
they're not something I need to worry about. 

Any comments from anyone on this?

	FYI, what it allows you to do with the push and pop is disable
certain warning messages and change warning levels at compile time for
certain headers. I can post the explanation and example, if anyone is
interested.

Thanks Kevin

-----Original Message-----
From: Kevin Buettner [mailto:kev@primenet.com]
Sent: Tuesday, September 05, 2000 1:12 PM
To: plug-devel@lists.PLUG.phoenix.az.us
Subject: Re: #pragma push and pop
On Sep 5, 11:13am, Lucas Vogel wrote:

> I am looking at DLL code on an MS platform, containing this line:
> 
> #pragma warning(pop)
> 
> MSDN says that #pragma is a place for operating-system specific features
> while remaining compliant with standard C++. Does Linux have a push/pop
> #pragma?

I think you're asking the wrong question.  The question you really
want to ask is "Does the GNU C/C++ compiler for Linux have a push/pop
#pragma?"

If you read the GCC manual, it would appear that the answer is "no."
The authors of the GCC manual strongly disapprove of pragmas and
provide the following reasons for this disapproval:

   1. It is impossible to generate #pragma commands from a macro. 
   2. There is no telling what the same #pragma might mean in another
      compiler.  

However, I just took a look at the current gcc development sources and
see the following in config/linux.h:

    /* Define this so we can compile MS code for use with WINE.  */
    #define HANDLE_PRAGMA_PACK_PUSH_POP

Moreover, there is a decent chunk of code in c-pragma.c which appears
to implement this functionality, so I would suspect that the answer
is actually "yes."

(I don't know what this pragma is supposed to do, so I was unable to
test it...)

Kevin

_______________________________________________
Plug-devel mailing list  -  Plug-devel@lists.PLUG.phoenix.az.us
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-devel