LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting rid of the int64 to double warning

Hello all,
Is there some kind of #pragma to get rid of the "Warning: Truncation from
__int64 to double" message ?
I know that the conversion is perfectly safe (I'm manipulationg 48 bits data
and double can hold 53 bit precision).

The list of pragma found on
http://zone.ni.com/reference/en-XX/help/370051H-01/cvi/pragmas/ is quite
lightweight, as there are periodically tips here with 'unsupported' pragmas
for specific tasks...

Thanks
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 1 of 9
(8,057 Views)
That's not true in general, though it may be in your case since you're using only 48 out of 64 bits.

The compiler can't know that you're not using all 64 bits - that's run time dependent.

The native CVI compiler is the LCC compiler from Princeton University.  Maybe you can find a reference on LCC for a __NOWARN__ pragma of some kind that would work.

Menchar


Message Edited by menchar on 12-20-2007 12:58 PM

Message Edited by menchar on 12-20-2007 01:03 PM
0 Kudos
Message 2 of 9
(8,036 Views)
I have exactly this same annoying situation. (Working with 48 bit arithmetic.) While it is entirely reasonable for the compiler to issue a warning, there ought to be a way for the programmer to carefully consider it and ignore it if he feels justified. In Visual C++ the compiler generates a similar warning, but if you simply add an explicit cast (eg: double_var = (double) int64_var; ) then the warning goes away. Sadly, the CVI compiler doesn't take the same hint. Another candidate for C99 compatability, perhaps?
 
JR


Message Edited by jr_2005 on 12-21-2007 10:20 AM
0 Kudos
Message 3 of 9
(8,020 Views)
Thanks for the tip about LCC.

I found the lcc-win32 user's manual at
http://www.q-software-solutions.de/downloaders/show_download_locations
But from what I gathered, there doesn't seem to be a 'compiler warning'
pragma.

What I found very interesting is that there are many functions of this
compiler which aren't supported by the CVI version: 128 bit integers, 350
bit floats (!!!), intrinsics, try/catch, garbage collector, operator
overloading, references, optional arguments... Matlab also relies on this
compiler and seems to accept more options.

Pleeeeease...
--
Guillaume Dargaud
http://www.gdargaud.net/
"Thesaurus /nm./: a dinosaur with an excellent vocabulary."


0 Kudos
Message 4 of 9
(8,012 Views)
I don't know just what version NI started with.  There's a C99 compliant version of LCC, so the requests for C99 support for the NI version of the LCC don't seem to be that outlandish.    Did you notice how quickly NI has came up with additional C99 features? 

Yup, you'd think the compiler would quiet down when you use an explicit cast.

I don't think anything in C99 would avoid the warning.

Those features may be present in LCC but they aren't part of the C99 spec.  Princeton does a lot of compiler development, I imagine they've rolled in features that they've developed for pedagogical purposes.

Menchar




0 Kudos
Message 5 of 9
(7,993 Views)
Hello all,

LabWindows/CVI is using the LCC compiler to implement ANSI C 89 compatibility.  There are a few features that were included in CVI 8.5 that are not part of the ANSI C 89 standard. They are part of the C99 standard, however; CVI is still not C99 compliant.  If you find these features useful and wish to use them, you just need to add #pragma to your source.  For more information on what C99 features have been added in LabWindows/CVI 8.5, please refer to this post

Additionally, if you do have specific features that you feel would be a good addition for future versions of LabWindows/CVI, you can let us know using the Product Suggestion Center.


0 Kudos
Message 6 of 9
(7,981 Views)
While digging into that Int64 matter I found inside Windows SDK the variables of type LARGE_INTEGER and ULARGE_INTEGER (depending if signed or unsigned) being defined this way:
 
typedef union _ULARGE_INTEGER {
    struct {
        DWORD LowPart;
        DWORD HighPart;
    };
    ULONGLONG QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;
 
These variables permit some treatment of 64 bit integer values inside CVI without warning at compile time nor errors at runtime.
I made a simple source code to use those variables to treat Int64 variables inside SDK and DAQmx functions (specifically GetDiskFreeSpaceEx and DAQmx_Read_TotalSampPerChanAcquired attribute on a running acquisition): it can be simply tested within the interactive execution window.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 9
(7,956 Views)

Hello,

 

I am getting this same warning in CVI 9.1.1 and was wondering if there are any #pragma yet to turn this off (apparently there weren't in 2007 when this thread first appeared).

 

Thanks,

 

Alex Corwin

0 Kudos
Message 8 of 9
(4,500 Views)

A pragma for this warning has not been added at this time. You can find a list of pragmas accepted by the CVI compiler in the Help topic Pragmas.

 

If you would like to see this feature in a future version, I would suggest adding your recommendations to the LabWindows\CVI Idea Exchange because this is our #1 source when researching new features.

National Instruments
0 Kudos
Message 9 of 9
(4,485 Views)