SHARE
TWEET

Function call evaluation order

Archon Dec 19th, 2010 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3.  
  4. typedef void (*func_t)(int x);
  5.  
  6. void func(int x){
  7.    std::cout << "evaluate function    ";
  8. }
  9.  
  10. func_t f(){
  11.    return &func;
  12. }
  13.  
  14.  
  15. int x(){
  16.    std::cout << "evaluate arg    ";
  17.    return 5;
  18. }
  19.  
  20.  
  21. int main(){
  22.    while(true){
  23.       f()(x());
  24.       std::cout << std::endl;
  25.    }
  26. }
RAW Paste Data
Want to get better at C++?
Learn to code C++ in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top