Last active
February 10, 2016 21:44
-
-
Save attatrol/62f017acae2cff99fe1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void f0() { | |
//NP(ternary) = 2 | |
int i = true ? 1 : 2; | |
//NP(cycle) = 2 | |
for(; i<10; i++) { | |
} | |
} | |
//NP(f0) = 4 | |
void f1() { | |
//NP(cycle) = NP(expr) + NP(range) + 1 = 2 + 1 + 1 = 4 | |
for(int i = true ? 1 : 2; i < 10; i++) { | |
} | |
} | |
//NP(f1) = 4 | |
//f0 and f1 are equivalent | |
void f2() { | |
//NP(cycle) = NP(expr) + NP(range) + 1 = 2 + 1 + 1 = 4 | |
for(int i = 1; i < true ? 10 : 15; i++) { | |
//NP(range) = 1 | |
} | |
} | |
//NP(f2) = 4 | |
void f3() { | |
int j = 15; | |
//NP(cycle) = NP(expr) + NP(range) + 1 = 0 + 2 + 1 = 3 | |
for(int i = 1; i < j; i++) { | |
//NP(range) = NP(ternary) = 2 | |
int j = true ? 10 : 15; | |
} | |
} | |
//NP(f3) = 3 | |
//NP(f2) != NP(f3) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment