08-05-2014 10:28 AM - edited 08-05-2014 10:30 AM
Here's something I just recently got burned with. It turns out that CVI 2013 evaluates parameters in a function call in a different order than CVI 2012. Take this code for example:
#include <stdio.h> void multiprint(int arg1, int arg2, int arg3, int arg4, int arg5) { printf("%d, %d, %d, %d, %d\n", arg1, arg2, arg3, arg4, arg5); return ; } int main(int argc, char *argv[]) { int i = 5; multiprint(i--, i--, i--, i--, i--); return 0; }
In CVI 2012, this will print:
1, 2, 3, 4, 5
In CVI 2013, this will print:
5, 4, 3, 2, 1
I actually did some digging on this, and it turns out that the order that parameters in a function call are evaluated in C is undefined, which means that while CVI 2013 compiles this code differently than CVI 2012, neither one of them are doing anything incorrect (per the specfication).
Anyhow, just something to watch out for if you're migrating projects to CVI 2013!
08-06-2014 02:24 PM
Hi,
Thank you for pointing this out. As you mentioned, the compiler has changed between the 2012 and 2013 versions of CVI. CVI 2012 uses a custom CVI compiler, whereas CVI 2013 switched over to the clang compiler.
Regards,
08-07-2014 04:37 PM
Hi tstanley,
Thank you for your post! I will make sure this behavior change makes it to the list of behavior changes for LabWindows/CVI 2013.
Warm regards,