Created
February 8, 2014 19:22
-
-
Save zeux/8888772 to your computer and use it in GitHub Desktop.
set_value overload madness
This file contains hidden or 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 <stdio.h> | |
void set_value(int rhs) | |
{ | |
printf("int\n"); | |
} | |
void set_value(unsigned int rhs) | |
{ | |
printf("uint\n"); | |
} | |
void set_value(double rhs) | |
{ | |
printf("double\n"); | |
} | |
void set_value(bool rhs) | |
{ | |
printf("bool\n"); | |
} | |
void set_value(long long rhs) | |
{ | |
printf("llong\n"); | |
} | |
void set_value(unsigned long long rhs) | |
{ | |
printf("ullong\n"); | |
} | |
int main() | |
{ | |
set_value((signed char)0); | |
set_value((unsigned char)0); | |
set_value((char)0); | |
set_value((short)0); | |
set_value((unsigned short)0); | |
set_value((int)0); | |
set_value((unsigned int)0); | |
set_value((long)0); | |
set_value((unsigned long)0); | |
set_value((long long)0); | |
set_value((unsigned long long)0); | |
set_value((float)0); | |
set_value((double)0); | |
set_value((long double)0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment