This is EXTREMELY bad code! The for loop gives the illusion that the system will attempt to read 256 method files, however this if statement will set the iterator value to greater than the magic number after the 10th action. Rather, the code should just have a
for (int i = 0; i < 10; i++) {}
This is doubly bad for setting the iterator value rather than `break`ing out of the loop.
This is tripply bad because it's not looking at the position within the loop with the iterator, rather it's using _another_ variable which is being essentially used like the iterator. If someone removes the `readdata++` line, the code will still loop but this will silently change behavior, there's no reason not to use `i` here - except for the bad reasons listed above.
```c
int readdata;
void readfilenames ()
{
int i, k, j, m;
// ... function misc
readdata = 0;
i = 1;
for (i; i < 256; i++)
{
if (fopen_rd(&writeto, i) == 0)
{
// Loop logic which performs some janky file I/O
readdata++;
if (readdata > 9)
i = 257;
}
}
}
```
**Bonus**: Yes, you read that correctly, `readdata` is even a global variable...
_This is a page in the collection of [[Chip Overflow/Willies|snippets that give me the willies]]_