Tag: 调用约定

如何“转到”c中的不同function?

基本上我试图在C中模拟汇编代码。 这是C代码: int main() { test(); main_next: printf(“Hello, World!”); } void test() { goto main_next; } 尝试编译此代码(Linux 32位,gcc 4.6.3),我收到此错误: error: label ‘main_randomtag_next’ used but not defined 有谁知道如何在C中进行这种程序间的转换? 谢谢!

根据AMD64 ABI,什么样的C11数据类型是arrays

我正在研究在OSX上使用的x86_64的调用约定,并且在System V x86-64 ABI标准中阅读了名为“Aggregates and Unions”的部分。 它提到了数组,我认为这就像一个固定长度的c数组,例如int[5] 。 我下到“3.2.3参数传递”来读取数组是如何传递的,如果我理解正确的话,像uint8_t[3]这样的东西应该在寄存器中传递,因为它小于规则1规定的4个8字节的限制。聚合类型的分类(第18页靠近底部)。 编译后,我看到它被作为指针传递。 (我正在使用OSX 10.11.6上的Xcode 7.3.1中的clang-703.0.31进行编译)。 我用来编译的示例源如下: #include #define type char extern void doit(const type[3]); extern void doitt(const type[5]); extern void doittt(const type[16]); extern void doitttt(const type[32]); extern void doittttt(const type[40]); int main(int argc, const char *argv[]) { const char a[3] = { 1, 2, 3 }; const […]

如何在gcc中实现变量参数?

int max(int n, …) 我正在使用cdecl调用约定,其中调用者在被调用者返回后清理变量。 我有兴趣知道宏va_end , va_start和va_arg工作的? 调用者是否将参数数组的地址作为max的第二个参数传递?