Skip to content

Instantly share code, notes, and snippets.

@nathanPro
Created October 13, 2018 16:30
Show Gist options
  • Save nathanPro/60f034534ffa48e0eb39375b7e1e901b to your computer and use it in GitHub Desktop.
Save nathanPro/60f034534ffa48e0eb39375b7e1e901b to your computer and use it in GitHub Desktop.
#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