官术网_书友最值得收藏!

  • Learn WebAssembly
  • Mike Rourke
  • 234字
  • 2021-08-13 15:38:49

C and C++

C and C++ are low-level programming languages that have been around for over 30 years. C is procedural and doesn't inherently support object-oriented programming concepts such as classes and inheritance, but it's fast, portable, and widely used. 

C++ was built to fill the gaps in C by adding features such as operator overloading and improved type checking. Both languages consistently rank in the top 10 most popular programming languages, which make them ideally suited for the MVP:

TIOBE Very Long Term History of the top 10 programming languages

C and C++ support is also baked into Emscripten, so in addition to simplifying the compilation process, it allows you to take advantage of WebAssembly's full capabilities. It is also possible to compile C/C++ code down to a .wasm file using LLVM. LLVM is a collection of modular and reusable compiler and toolchain technologies. In a nutshell, it's a framework that simplifies the configuration of a compilation process from source code to machine code. If you made your own programming language and would like to build a compiler, LLVM has tools to simplify the process. I'll cover how to compile C/C++ into .wasm files using LLVM in Chapter 10, Advanced Tools and Upcoming Features.

The following snippet demonstrates how to print Hello World! to the console using C++:

#include <iostream>

int main() {
std::cout << "Hello, World!\n";
return 0;
}

主站蜘蛛池模板: 宁晋县| 蓬溪县| 浦城县| 西吉县| 壤塘县| 鸡东县| 宣汉县| 哈尔滨市| 平谷区| 桑日县| 郧西县| 合阳县| 穆棱市| 寿宁县| 米易县| 涞水县| 库伦旗| 微山县| 宾阳县| 彭山县| 正蓝旗| 宁波市| 休宁县| 揭阳市| 称多县| 双柏县| 广灵县| 定边县| 临洮县| 赤城县| 丹巴县| 滕州市| 铜鼓县| 苍山县| 东山县| 普兰店市| 突泉县| 陆丰市| 耒阳市| 澎湖县| 武穴市|