LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I temporarily disable compiler warnings?

I like compiling with all warnings & errors turned on.  However, there are sometimes places in the code where I *do* expect a warning. Since I know I expect it, I don't want the compiler to tell me about it. Here's an example:

 

     LARGE_INTEGER           freq;

     double           f;

 

     QueryPerformanceFrequency(&freq);

     f = (double)freq.QuadPart;  // expect a warning here

 

I want to disable the compiler warning for that one line of code. Or maybe for the function it's in.
Some compilers have a way to do this with #pragma.

Am I just missing this somewhere in the help for CVI?

 

In case it's clear:   DisableBreakOnLibraryErrors() and EnableBreakOnLibraryErrors() are of no help.   I'm trtying to remove compile-time warnings, not run-time ones.

 

Thanks for your help.

 

0 Kudos
Message 1 of 6
(4,457 Views)

Hello KKH,

 

#pragma is exactly what you are looking for, you can see which pragmas are supported by your version of CVI by opening the help and typing "pragmas" in the index.

 

Here is a discussion forum which mentions some other functionality in CVI that is not officially supported but will possibly work.

With warm regards,

David D.
0 Kudos
Message 2 of 6
(4,425 Views)

I looked in the help before posting, and found a disappointingly small (to me, at least) set of #pragmas. 

 

My ancient Borland DOS compiler let me turn off individual compiler warnings, for every warning the compiler would generate.  I had hoped LabWindows had the same functionality and I'd just not found it yet, even after years of on again, off again looking.  (Am now using version 8, have used versions 7, 5, and 3.)

 

 

0 Kudos
Message 3 of 6
(4,423 Views)

Hello KKH,

 

Which version are you currently using?

 

One thing I did want to mention is that we appreciate feedback and have a product suggestion center where you can ask for a particular functionality or feature to be implemented in a future version of our software. I am going to submit this suggestion for you but feel free to suggest any other features you think would be beneficial at any time.

With warm regards,

David D.
0 Kudos
Message 4 of 6
(4,418 Views)

Hello KKH,

 

Unfortunately, we currently do not have an extensive list of pragma's that will allow you to turn off specific, individual compiler warnings, outside of what you have already seen in the help.  However, the specific compiler warning you have mentioned in your first post has been turned off internally as of CVI 8.5.  You will still receive the compile warning if you do not explicitly cast freq.QuadPart to a double, but we assume in 8.5 and later that if you do explicitly cast, you know that you may be losing some precision, and thus do not give the warning.

 

NickB

National Instruments 

0 Kudos
Message 5 of 6
(4,404 Views)

Thanks for the info, guys.  I have upgraded everybody else in the group from 8.0 to 8.5; guess it's time to get around to upgrading myself!


Kevin

 

0 Kudos
Message 6 of 6
(4,390 Views)