Last active
December 9, 2016 09:10
-
-
Save dgelessus/f1f793c2055e1ee0afff42346328077a to your computer and use it in GitHub Desktop.
Test code to figure out which objc_msgSend variants are used in which case on what architecture
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
struct char1 { | |
char x[1]; | |
}; | |
struct char2 { | |
char x[2]; | |
}; | |
struct char3 { | |
char x[3]; | |
}; | |
struct char4 { | |
char x[4]; | |
}; | |
struct char5 { | |
char x[5]; | |
}; | |
struct char6 { | |
char x[6]; | |
}; | |
struct char7 { | |
char x[7]; | |
}; | |
struct char8 { | |
char x[8]; | |
}; | |
struct char9 { | |
char x[9]; | |
}; | |
struct char10 { | |
char x[10]; | |
}; | |
struct char11 { | |
char x[11]; | |
}; | |
struct char12 { | |
char x[12]; | |
}; | |
struct char13 { | |
char x[13]; | |
}; | |
struct char14 { | |
char x[14]; | |
}; | |
struct char15 { | |
char x[15]; | |
}; | |
struct char16 { | |
char x[16]; | |
}; | |
struct char17 { | |
char x[17]; | |
}; | |
@interface DGMsgSendTest | |
@end | |
@implementation DGMsgSendTest | |
+(struct char1)char1 { | |
struct char1 ret = {""}; | |
return ret; | |
} | |
+(struct char2)char2 { | |
struct char2 ret = {" "}; | |
return ret; | |
} | |
+(struct char3)char3 { | |
struct char3 ret = {" "}; | |
return ret; | |
} | |
+(struct char4)char4 { | |
struct char4 ret = {" "}; | |
return ret; | |
} | |
+(struct char5)char5 { | |
struct char5 ret = {" "}; | |
return ret; | |
} | |
+(struct char6)char6 { | |
struct char6 ret = {" "}; | |
return ret; | |
} | |
+(struct char7)char7 { | |
struct char7 ret = {" "}; | |
return ret; | |
} | |
+(struct char8)char8 { | |
struct char8 ret = {" "}; | |
return ret; | |
} | |
+(struct char9)char9 { | |
struct char9 ret = {" "}; | |
return ret; | |
} | |
+(struct char10)char10 { | |
struct char10 ret = {" "}; | |
return ret; | |
} | |
+(struct char11)char11 { | |
struct char11 ret = {" "}; | |
return ret; | |
} | |
+(struct char12)char12 { | |
struct char12 ret = {" "}; | |
return ret; | |
} | |
+(struct char13)char13 { | |
struct char13 ret = {" "}; | |
return ret; | |
} | |
+(struct char14)char14 { | |
struct char14 ret = {" "}; | |
return ret; | |
} | |
+(struct char15)char15 { | |
struct char15 ret = {" "}; | |
return ret; | |
} | |
+(struct char16)char16 { | |
struct char16 ret = {" "}; | |
return ret; | |
} | |
+(struct char17)char17 { | |
struct char17 ret = {" "}; | |
return ret; | |
} | |
+(signed char)aChar { | |
return 0; | |
} | |
+(short)aShort { | |
return 0; | |
} | |
+(int)anInt { | |
return 0; | |
} | |
+(long)aLong { | |
return 0L; | |
} | |
+(long long)aLongLong { | |
return 0LL; | |
} | |
+(float)aFloat { | |
return 0.0f; | |
} | |
+(double)aDouble { | |
return 0.0; | |
} | |
+(long double)aLongDouble { | |
return 0.0L; | |
} | |
@end | |
int main(int argc, char **argv) { | |
struct char1 char1 = [DGMsgSendTest char1]; | |
struct char2 char2 = [DGMsgSendTest char2]; | |
struct char3 char3 = [DGMsgSendTest char3]; | |
struct char4 char4 = [DGMsgSendTest char4]; | |
struct char5 char5 = [DGMsgSendTest char5]; | |
struct char6 char6 = [DGMsgSendTest char6]; | |
struct char7 char7 = [DGMsgSendTest char7]; | |
struct char8 char8 = [DGMsgSendTest char8]; | |
struct char9 char9 = [DGMsgSendTest char9]; | |
struct char10 char10 = [DGMsgSendTest char10]; | |
struct char11 char11 = [DGMsgSendTest char11]; | |
struct char12 char12 = [DGMsgSendTest char12]; | |
struct char13 char13 = [DGMsgSendTest char13]; | |
struct char14 char14 = [DGMsgSendTest char14]; | |
struct char15 char15 = [DGMsgSendTest char15]; | |
struct char16 char16 = [DGMsgSendTest char16]; | |
struct char17 char17 = [DGMsgSendTest char17]; | |
signed char aChar = [DGMsgSendTest aChar]; | |
short aShort = [DGMsgSendTest aShort]; | |
int anInt = [DGMsgSendTest anInt]; | |
long aLong = [DGMsgSendTest aLong]; | |
long long aLongLong = [DGMsgSendTest aLongLong]; | |
float aFloat = [DGMsgSendTest aFloat]; | |
double aDouble = [DGMsgSendTest aDouble]; | |
long double aLongDouble = [DGMsgSendTest aLongDouble]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment