Skip to content

Commit b98d5d2

Browse files
authored
Translate 03inline-function.md
1 parent 4836194 commit b98d5d2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/en/quickstart/04function/03inline-function.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
lastUpdate: true
33
---
44

5-
# 内联函数
5+
# Inline function
66

7-
MCFPP中,可以使用`inline`关键字来声明一个内联函数。编译器会在调用内联函数的地方直接将函数的代码插入,而不是通过函数调用的方式来执行。这样可以减少函数调用的开销,提高程序的运行效率。
7+
In MCFPP, we can use keyword `inline` to declare an inline function. When call this function, compiler will insert the code into the code directly, but not call the function. So it can reduce the cost of calling functions, make the program more efficient.
88

9-
## 内联函数的声明
9+
## Declare of inline function
1010

11-
内联函数的声明语法如下:
11+
The grammar of declare a inline function is:
1212

1313
```mcfpp
1414
inline func functionName(parameter1, parameter2, ...) -> returnType{
15-
#函数体
15+
#Function body
1616
}
1717
```
1818

19-
## 内联函数的调用过程
19+
## Call of inline function
2020

21-
在调用内联函数的地方,编译器会直接将内联函数的代码插入,而不是通过函数调用的方式来执行。例如下面的例子:
21+
In the place of calling inline function, compiler will insert the inline function directly, but not call the function. Such as the example below:
2222

2323
```mcfpp
2424
inline func add(int a, int b) -> int{
@@ -30,7 +30,7 @@ func main(){
3030
}
3131
```
3232

33-
编译的时候,上述代码会相当于:
33+
During compilation, the code is same as:
3434

3535
```mcfpp
3636
func main(){
@@ -41,4 +41,4 @@ func main(){
4141
}
4242
```
4343

44-
这同时意味着,在内联函数中,对变量的修改会影响到函数外部的变量。
44+
This means that, in the inline function, the change to variable will effect the variable out of the function.

0 commit comments

Comments
 (0)