02-26-2015 09:45 AM
These two cause errors:
extern int const constint_var; // error: redefinition of 'constint_var' with a different type int constint_var;
void test_constint_ptr(int const *i); // error: conflicting types for 'test_constint_ptr'
void test_constint_ptr(int *i) { *i = 3; i = NULL; }
But the following not:
void test_constint(int const i); // NO ERROR void test_constint(int i) { i = 3; }
void test_int_constptr(int *const i); // NO ERROR void test_int_constptr(int *i) { *i = 3; i = NULL; }
I see that the ones which don't cause an error have no impact on the caller and thus it doesn't matter to them (and the compiled code there) if the functions modify their local values.
Yet I find this confusing because the prototype doesn't match the function. A compiler warning would be nice, like Visual Studio has.
02-27-2015 06:02 AM
Hi CVI_User,
could you please post the compiler messages for the error cases, too?
Which CVI version do you use?
Best regards,
Melanie
03-04-2015 02:45 AM
The error messages of Clang (CVI 2013 SP1) are already included in the comments inside the code samples.
It's not a bug report, I'd just like to know what others think of this.