Here, at CF, we have 4 compiler options for C/C++. But I think it's not enough xD Did you know that MSVC++ can compile JIT code for C++?
/clr compiles C++ usual fashion, just bundles it in .NET container
/clr:pure makes CLR(JIT) code. Similar to using C# in unsafe mode, but faster. Standard c++ library works.
/clr:safe is similar to using c# in safe mode. C++ standard library won't work.
Code for Fibonacci where c# outperformed AOT-compiled c++ was used by some people to prove c# is superior. But C++ users can join Fibonacci likers too:
C:\00>copy con fib.cpp
#include <windows.h>
#include <stdio.h>
int fib(int n) {
return n<2?n:fib(n-2)+fib(n-1);
}
int main() {
int x = GetTickCount();
int param = 42;
int res = fib(param);
x=GetTickCount()-x;
printf("fib(%d)=%d\n",param,res);
printf("ticks: %d\n",x);
}
^Z
Скопировано файлов: 1.
C:\00>cl /W4 /F268435456 /EHsc /O2 fib.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
fib.cpp
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
/out:fib.exe
/stack:268435456
fib.obj
C:\00>fib
fib(42)=267914296
ticks: 2745
C:\00>cl /clr:pure /W4 /F268435456 /O2 fib.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.21022.08
for Microsoft (R) .NET Framework version 2.00.50727.5467
Copyright (C) Microsoft Corporation. All rights reserved.
fib.cpp
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
/out:fib.exe
/clrimagetype:pure
/stack:268435456
fib.obj
C:\00>fib
fib(42)=267914296
ticks: 2152
C:\00>