07-08-2019 03:21 AM
Hi,
I've just changed my computer and just installed the new CVI release: 2019.
So far I was using CVI 2013 and I was worried about the possible issues upgrading the IDE, due to the complexity of some projects I've developed and my company uses in the production lines.
I've been so happy when, after launching the Build on the most complex project, I've got two new Warnings only.
The first one is about the cast from function call.
Looking at the screen shot below, it seems that recasting a variable form int to double is allowed "(double)iDrvFreq", while recasting the result of a function call from int to double "(double)rand()" generates a warning.
The second is about illegal character encoding, underlined in red in the following screen shot.
It is related to a string where I'm showing the result of an acceleration measurement using the correct M.U.
My question is: CVI 2013 didn't give me any warning message and the application worked fine, should I expect any different behavior of the application generated by CVI 2019? If yes, any appreciable suggestions?
Thank you
Sergio
07-11-2019 08:13 AM
Hi Sergio,
the warnings you get shouldn't affect the behavior of your application, however here are some tips I can give you about it.
As an alternative solution, this thread suggests to simply turn off warnings in the way described here.
Regards,
Alessia
07-11-2019 09:50 AM
Hi Alessia,
thank you for your reply.
About the first point I'm going to turn off the warnings, because I was already using the Alt Code.
For the second point I've already modified my code (in the way you are suggesting me) immediately after getting the warning because I really hate collecting any type of warnings while compiling.
It has been very kind of you, I do really appreciate.
Sergio
07-15-2019 06:11 AM
Alessia, entering the character with Alt+253 (or Alt+0178) by keyboard has the identical effect of entering the character with any other means (e.g. pasting from Character Map application).
So your suggestion sounds somewhat funny to me.
One simple and working way to have a character literal in a string with code > 127 is by using an escape sequence and the hexadecimal notation. In our case, Sergio should enter "\xB2" and the compiler will no more complain for illegal encoding.
That code will be rendered, when printed, in the current device character set encoding (most likely 8 bit Unicode).
About the other warning, it's a legit warning being a cast applied to the function return value, and the solution proposed by Alessia is correct.
You can found a slightly more elaborate answer on this warning at this link.
Ciao
07-15-2019 06:44 AM
Hi Carlo,
I was supposing that some escape sequence might work but I didn't try, so thank you!
The other warning is legit of course, my question was about the compiler behavior, because I knew that I was recasting something "recastable" being aware about the loss of accuracy and it was acceptable to my purposes.
Again, thank you all.
Ciao
Sergio