Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
return reference (msvc)
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> const int& func() { int a=10; return a; } void func2(int v) { std::cout<<"function: "<<v<<std::endl; } int stackFunc() { int a1 = 15; int a2 = a1; int a3 = a2; return a3; } int main() { // Моментальное использование int b = func(); std::cout << "b: " << b << std::endl; const int& ra = func(); std::cout << "ra: " << ra << std::endl; const int& ra2 = func(); int aa = ra2; std::cout << "aa: " << aa << std::endl; // Действия со стеком const int& ra3 = func(); stackFunc(); int stack = ra3; std::cout << "stack: " << stack << std::endl; // Вызов функции func2(func()); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
defined(FOO)
trying to find if reinterpret_cast preserves calling convention
Iterate_Variac_Template
constexpr internal error
timeConversion
fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
Visual C++ template instantiation
karma legacy "variant" with attr_cast
make Derive final
Type deduction in VC++
Please log in to post a comment.