gcc/g++ equivalent for BC++ #pragma warn -xxx
Günter NeiÃÂ
gneiss@schoenhofer.de
Wed Jan 24 10:23:00 GMT 2001
Hi,
I try to wrote all of my prg's such way, that there is no error/warning
from the compiler.
I swich all warnings on.
I thing: most of the cases a warning leads to some errors I made,
only some are just the thing I wan't.
Most of the time I am able to modify my code to supress the warning for
that cases.
But I found no way to supress the warning:
------ taking address of temporary --------
Because this is just what I mean, I look for something to supress this
message, but only for the line of code it happens (meaning that the same
problem my exist at other places in my code and there it isn't what I
like to do).
Using other compilers (e.g. BC++) I use
#pragma warn -xxx
xxx stands for the warning I like to suppress.
Is there a way to do that with gcc ??
Some more info's on that:
Version of G++ I use: 2.95.2 (Linux/pentium)
gcc options used: at least -Wall
Some code-fragment that exhibits the warning:
class Foo
{
.. // two dots (..) mean some code left off
};
void bar( Foo * pobj, ... ) // three dots (...) mean the elipse
(optional parameters)
{
// bar should process a list of Foo-objects, that's why i can't use
'Foo & obj'
va_arg ..
..
}
.. main ..
{
bar( &Foo(), NULL ); // this line gives the warning
}
As You see the above statement
bar( &Foo(), NULL );
creates a temporary object of class Foo, it's address was taken and
supplied to the function bar.
In most circumstances that isn't what someone migth, but it's right what
I need in this situation.
Thanks & greetings
Günter
Kryptographische Unterschrift mit S/MIME
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/octet-stream
Size: 3748 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20010124/09ba1ca6/attachment.obj>
More information about the Gcc-help
mailing list