LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NaN constant CVI 8.0

I realize this topic has been explored before, but I can't seem to get to the archived messages (2004)
 
Is there a way to use the IEEE NaN as a constant?  I have a struct of doubles I'd like to initialize to NaN, and I need a constant to do so.
 
I tried the ivi.h IVI_NAN as an initializer but the compiler barfs and says it's not a constant.
 
C99 apparently has such a constant in math.h, but the C89 CVI compiler doesn't  😞
 
When is NI going to give us a C99 compiler for CVI?
 
Hayes
0 Kudos
Message 1 of 5
(4,740 Views)
NaN can be found in
Programmer's Toolbox -> NotANumber()
or see toolslib\toolbox\toolbox.c

There are compare funtions like IsNotANumber(), too.
-----------------------
/* Nothing past this point should fail if the code is working as intended */
Message 2 of 5
(4,735 Views)
That doesn't do the trick - has to be a constant.  NotANumber() is a function.
 
C99 allows non-constant initializers for structs and arrays, but the C89 CVI compiler requires constants.
 
When is NI going to give us a C99 compiler for CVI?   It's not too much to ask, given the cost of CVI.  I keep running into issues that are a problem with C89 but have been fixed in C99. 
 
Hayes
0 Kudos
Message 3 of 5
(4,715 Views)

Hi Hayes,

I understand your frustration.  We have had a number of customer requests for a C99 compiler and I know that R&D is looking at this.  A great way to get your voice heard is to submit a product suggestion at our product suggestion center (http://digital.ni.com/applications/psc.nsf/default?openform).  All of these suggestions to right to R&D.

As for your question about NaN, have you seen this post:  http://forums.ni.com/ni/board/message?board.id=180&message.id=8449&requireLogin=False?  Perhaps the last suggestion would work for you.

Thanks for the feedback,
Megan B.
Applications Engineer
National Instruments

0 Kudos
Message 4 of 5
(4,700 Views)

Megan -

Thanks for the reply.

No, as I stated in my first post, the IVI NaN "constant" isn't really a constant - apparently it's a macro dereferencing a pointer to a NaN value somewhere in the IVI library.- the C89 CVI compiler flags it as an error ("must be a constant").  The dereferencing is a run-time activity that can't be handled at compile time.

I'll send my suggestion to the link you provided.

Hayes 

0 Kudos
Message 5 of 5
(4,696 Views)