You have a function simple() that is called frequently in your code. You place the inline prefix on the function. What effect does it have on the code?
inline fun simple(x: Int): Int{
return x * x
}
fun main() {
for(count in 1..1000) {
simple(count)
}
}
inline fun simple(x: Int): Int{
return x * x
}
fun main() {
for(count in 1..1000) {
simple(count)
}
}A. The code will give a stack overflow error
B. The compiler warns of insignificant performance impact
C. The compiler warns of significant memory usage
D. The code is significantly faster
Answer: Option B

Join The Discussion