Created
October 13, 2018 16:30
-
-
Save nathanPro/60f034534ffa48e0eb39375b7e1e901b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "bits/stdc++.h" | |
using namespace std; | |
int fn(int a, ...) { | |
return 1; | |
} | |
double fn(int a, int b) { | |
return 1.0; | |
} | |
void handle(int) { | |
printf("...\n"); | |
} | |
void handle(double) { | |
printf("(int, int)\n"); | |
} | |
int main() { | |
// prints (int, int) | |
handle(fn(10, 10)); | |
// prints (int, int) | |
// I am not sure why, think it is because ... does not 'see' types | |
handle(fn(10, 'a')); | |
// prints ... | |
handle(fn(10, 10, 10)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment