![]() | Fun 0.41.5 The programming language that makes You have fun |
Fun VM C++ opcode snippet: add two 64-bit integers (cpp_add). More...

Go to the source code of this file.
Functions | |
| int | fun_op_cpp_add (VM *vm) |
| Add two 64-bit integers from the VM stack and push the sum. | |
Fun VM C++ opcode snippet: add two 64-bit integers (cpp_add).
This opcode is compiled and linked only when the CMake option -DFUN_WITH_CPP=ON is enabled. It demonstrates how to implement a VM opcode in C++ while exposing a C ABI symbol for the VM dispatcher.
Stack behavior:
Error handling and type conversions (e.g., from other numeric types to int64) are delegated to the VM helpers vm_pop_i64 and vm_push_i64.
Definition in file add.cpp.
| int fun_op_cpp_add | ( | VM * | vm | ) |
Add two 64-bit integers from the VM stack and push the sum.
Pops two values from the VM stack using vm_pop_i64, adds them as 64-bit signed integers, and pushes the result via vm_push_i64.
Stack effect:
| vm | Pointer to the VM instance. Must not be NULL. |
Definition at line 47 of file add.cpp.
