C4018, Really that bad?

Joined
Jul 9, 2010
Messages
2
Reaction score
0
Hey guys,

I did a search on the website and Google and couldn't find the answer I was looking for. Most of the answers I found said the compile error did not matter; to ignore the error; or that the error could lead to mistakes -bugs- in future programs.

I understand that it's an issue with comparing assigned and unassigned values, and, for me, this error usually occurs when I'm using a vector size as an end condition on a for loop.

Example:

for (int i = 0; i<numbers.size(); i++)

I was thinking of ways to fix this, but didn't know if this was the best solution... if a solution at all.

Example Fix:

int t = numbers.size();
for (int i = 0; i<t; i++)

The program works fine sans fix, but, as said before, some of the things I have been reading say to fix this compile error because comparing unassigned to assigned values can mess up "big" programs.

Thanks for your help~

K
 
Joined
Jul 9, 2010
Messages
2
Reaction score
0
I'm reading over the error chapter in my textbook, but I still can't find the answer... anyone?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top