the code:
#include <iostream> using namespace std; int f(int x = 0) { cout << "x:" << x << endl; return 0; } int main() { f(); int f(int x = 1); f(); return 0; }
Exit (tested on g ++ 5.1):
x:0 x:1
My question is:
- Is
int f(int x = 1); declaration or definition? - Is re-declaring a function like undefined behavior?
c ++
Sayakiss
source share