Weird warning message, it makes no sense
-
dims, res, cap, v_sol and sol are just class members, they are set elsewhere in the program. It kind of makes the point.
-
-
@jsulm dims is read in from a file it's usually 5 or 10 with:
#define MAX_DIMS 10Why wouldn't all elements be initialised? The init loop will always execute and dims is not changed, there is no multithreading.
@Guerrian said in Weird warning message, it makes no sense:
Why wouldn't all elements be initialised, the init loop will always execute?
Did you debug your code to see what happens? This is fastest way to find out what is happening.
-
@Guerrian said in Weird warning message, it makes no sense:
Why wouldn't all elements be initialised, the init loop will always execute?
Did you debug your code to see what happens? This is fastest way to find out what is happening.
-
@jsulm I don't need to debug it because it is working fine, the results are good and look correct.
@Guerrian
I don't quite get your problem, dims is a non constant member variable, that may or may not be changed between the 2 for loops.the code model can't tell and is therefore warning you. If you're sure that everything will always be fine, ignore it.
if you want to get rid of the warning. shadow it locally.
void MMKPH::rndLcl(int seed, int its, int lcl) { const int dims = this->dims; .....
-
@Guerrian
I don't quite get your problem, dims is a non constant member variable, that may or may not be changed between the 2 for loops.the code model can't tell and is therefore warning you. If you're sure that everything will always be fine, ignore it.
if you want to get rid of the warning. shadow it locally.
void MMKPH::rndLcl(int seed, int its, int lcl) { const int dims = this->dims; .....
-
@J.Hilk said in Weird warning message, it makes no sense:
const int dims = this->dims;
Your shadow trick didn't work. I added this line to the top of the function and I still get the warning:
const int dims = this->dims;
-
@J.Hilk Got it, finally it makes sense. So I just wrote it like this to only declare what's required:
int i, j, k, l, v, q, sj, r[dims], tr[dims], ti[lcl], tj[lcl];
@Guerrian if your issue is solved, please don't forget to mark your post as such. Thanks.