File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ int main()
245245 return 0;
246246}
247247```
248- 我们知道name的值分配在栈上 ,而" pangudashu" 分配在常量区,那么" name" 变量名分配在哪呢?
248+ 我们知道指针name分配在栈上 ,而" pangudashu" 分配在常量区,那么" name" 变量名分配在哪呢?
249249
250250实际上C里面是不会存变量名称的,编译的过程会将变量名替换为偏移量表示:`ebp - 偏移量`或`esp + 偏移量`,将上面的代码转为汇编:
251251```c
@@ -272,7 +272,7 @@ main:
272272
273273![ php vs c] ( ../img/php_vs_c.png )
274274
275- 在编译时就可确定且不会改变的量称为字面量,也称作常量(IS_CONST),这些值在编译阶段就已经分配zval,保存在` zend_op_array->literals ` 数组中(对应c程序的常量内存区 ),访问时通过` _zend_op_array->literals + 偏移量 ` 读取,举个例子:
275+ 在编译时就可确定且不会改变的量称为字面量,也称作常量(IS_CONST),这些值在编译阶段就已经分配zval,保存在` zend_op_array->literals ` 数组中(对应c程序的常量存储区 ),访问时通过` _zend_op_array->literals + 偏移量 ` 读取,举个例子:
276276``` c
277277<?php
278278$a = 56 ;
@@ -372,11 +372,11 @@ void zend_compile_stmt(zend_ast *ast)
372372 switch (ast->kind) {
373373 case xxx:
374374 ...
375- break;
375+ break;
376376 case ZEND_AST_ECHO:
377377 zend_compile_echo(ast);
378378 break;
379- ...
379+ ...
380380 default:
381381 {
382382 znode result;
You can’t perform that action at this time.
0 commit comments