09-12-2008 05:36 PM
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.
09-15-2008 12:52 PM
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.
09-15-2008 01:02 PM
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.)
09-15-2008 01:36 PM
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.
09-15-2008 04:26 PM
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
09-15-2008 07:29 PM
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