How do you 'shut-up' warnings?

Started by
17 comments, last by Pipo DeClown 20 years, 6 months ago
I''m working on a project in Dev-C++, but I programmed a ''warning''.. It''s not a bug or an error, so I''m trying to remove the warning out of my compile log. Is there a (prefered: standard) way to do this? .lick
Advertisement
I usually just fix the code.
&D3DXVECTOR3(0,0,0) as a parameter, 3 times in one function.

How do you fix this? (duh, without using 3 temporary variables)

.lick
Well, warnings often-times need to be fixed just as errors do...people who disable warnings are basically ignoring help from their compiler telling them something is wrong.

EDIT: That is called taking the address of a temporary variable...that is a bad thing. And yes, I believe you *are* supposed to create three temporary vars (if they're all to 0,0,0 though, you could just create one and reference it 3 times).

[edited by - AikonIV on October 10, 2003 8:58:48 AM]
So you say that thousands and millions of people are doing it the wrong way? Even the people who wrote DirectX and it''s doc?

.lick
I always set my c++ compiler settings to Level 4 (sticter settings that expose more warnings). I wish that was the DEFAULT behavior.

Pipo can you post more code (and the warning message)? I did similar things and I want to compare any differences.
There''s not a universal standard but many compilers support a "#pragma warning" construct. Look it up in your help and see if your compiler supports it.

---CyberbrineDreamsSuspected implementation of the Windows idle loop: void idle_loop() { *((char*)rand()) = 0; }
Ignoring warnings should be done with extreme caution. As others have pointed out, it''s usually a sign that something is wrong with your program. I''ve worked with programmers who happily ignore warnings because, after all, "they''re just warnings". Then they don''t understand why the program crashes unexpectedly in production.

--
Dave Mikesell
d.mikesell@computer.org
http://davemikesell.com
quote:DirectX9 SDK document
D3DXMATRIX matView;
D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3( 0.0f, 3.0f,-5.0f ),
&D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),
&D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );
g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );

quote:Dev-C++ 5 beta (mingw??)
[ Warning ] taking address of temporary


I REALLY REALLY don''t think this warning will crash my program, or create a bug somewhere in it.
Thanks MauMan, I''ll have a look.

.lick
#pragma warning ( disable : warning number )
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno

This topic is closed to new replies.

Advertisement