my friend works at apple, said this was in the iOS7 update:
Code:
void * memcpy ( void * destination, const void * source, size_t num )
{
#ifdef (IPHONE4 || IPHONE4S)
int i;
for(i=0; i<32767; i+2) i--;
#endif
...
}
That code is nonsensical for several reasons.
1. The
ifdef (IPHONE4 || IPHONE4S) is a preprocessor conditional. It will either always be present or not based on the condition
at the time of compile. This code will not differentiate between an iphone 4 and an iphone 5/6 etc.
2. The for loop does not actually write any memory location other than
i. So it is likely that a good complier would simply eliminate this entire loop altogether since i is not used, unless i is used further on within the memcpy function.
3 for(i=0; i<32767;
i+2) while technically not a syntax error, it is bad coding nonetheless. The for loop will not increase i by 2 each loop. To do that you would need to change it to
i += 2. So what you have is simply a loop that decrements i by one each time (
i--). Now here is where things get a little more complicated. Since i is declared as an int, it will either be a 32 bit singed integer, or possibly a 16 bit signed integer. The 32767 sort of implies that it is a 16 bit integer, but given the sloppy coding elsewhere I cant accept that out of hand. Because we dont know for sure whether i is 16 bit or 32 bit, it means the for loop could process in two radically different ways:
i is 16 bit: So i starts at zero and counts down until it is no longer less than 32767. Which means the loop ends when i goes below -32768 at which point it goes to 32767. So the for loop ends after about 32768 loops.
i is 32 bit: So i starts at zero and counts down until it is less than 32767. But because it is 32 bit it will take 2 billion loops before it is no longer less than 32767!