Web上充满了不同语言,编译器和虚拟机的各种性能测试.然而,几乎没有任何一个使用一些真实场景来测试性能.此外,在Google上搜索这些基准测试通常只会产生几年前的基准测试,因为他们有最多的时间收集链接.
您是否有任何人真正了解不同虚拟机的当前性能?另外我特别想知道如何单声道的效果的对比于那些微软的.Net和Sun的Java,以及如何不同的虚拟机的性能近来发展的.
所以我有这段简单的代码,演示了一个简单的缓冲区溢出:
#include <stdio.h>
int main(void)
{
char c[4] = { 'A', 'B', 'C', 'D' };
char d[4] = { 'W', 'X', 'Y', 'Z' };
printf("c[0] is '%c'\n", c[0]);
d[4] = 'Z'; /* Overflow that overwrites c[0] */
printf("c[0] is '%c'\n", c[0]);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出:
$ ./a.out
c[0] is 'A'
c[0] is 'Z'
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下gcc选项编译此代码,并使用飞行颜色传递:
gcc -Wall -Wextra -Wformat=2 -Wswitch-default -Wcast-align -Wpointer-arith \
-Wbad-function-cast -Wstrict-prototypes -Winline -Wundef -Wnested-externs \
-Wcast-qual -Wshadow -Wwrite-strings -Wconversion -Wunreachable-code \
-Wstrict-aliasing=2 -ffloat-store -fno-common -fstrict-aliasing \
-Wstack-protector …Run Code Online (Sandbox Code Playgroud) 我真的很想知道这段代码
<?
session_start()
$_SESSION['me'] = 654;
$me = $_GET['me'];
echo $_SESSION['me'];
?>
Run Code Online (Sandbox Code Playgroud)
它将打印$ me值而不是$ _SESSION ['me']值.
这是一个错误还是出于安全原因这样做?任何解释?