国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 操作系統 > 正文

gcc中__builtin_return_address和__VA_ARGS__

2024-06-28 13:19:22
字體:
來源:轉載
供稿:網友
gcc中__builtin_return_address和__VA_ARGS__— Built-in Function: void * __builtin_return_address (unsigned int level)

This function returns the return address of the current function, or of one of its callers. The level argument is number of frames to scan up the call stack. A value of 0 yields the return address of the current function, a value of 1 yields the return address of the caller of the current function, and so forth. When inlining the expected behavior is that the function returns the address of the function that is returned to. To work around this behavior use the noinline function attribute.

The level argument must be a constant integer.

On some machines it may be impossible to determine the return address of any function other than the current one; in such cases, or when the top of the stack has been reached, this function returns 0 or a random value. In addition, __builtin_frame_address may be used to determine if the top of the stack has been reached.

Additional post-PRocessing of the returned value may be needed, see __builtin_extract_return_addr.

Calling this function with a nonzero argument can have unpredictable effects, including crashing the calling program. As a result, calls that are considered unsafe are diagnosed when the-Wframe-address option is in effect. Such calls should only be made in debugging situations.

官方文檔: http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html初步理解,此內建函數根據參數level返回當前函數的返回地址及當前函數調用者的返回地址,可以一直追溯到整個函數調用棧情況。__VA_ARGS__c99最新引入的可變參數宏,可以解決之前宏定義中沒法使用可變參數的問題。#define my_print1(fmt, args...) printf(fmt, ##args)#define my_print2(fmt, ...) printf(fmt, ##__VA_ARGS__)這兩個宏定義功能一致,實現稍微有點區別。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 澄江县| 盈江县| 尉氏县| 大安市| 会同县| 修文县| 年辖:市辖区| 新民市| 特克斯县| 临夏县| 枣庄市| 类乌齐县| 云梦县| 博爱县| 土默特右旗| 汉阴县| 洛浦县| 图木舒克市| 高台县| 汝南县| 右玉县| 定边县| 揭阳市| 建湖县| 阜宁县| 会泽县| 龙海市| 洪雅县| 偏关县| 广东省| 长治市| 桓台县| 昌宁县| 郓城县| 嘉鱼县| 瑞金市| 通榆县| 博乐市| 郧西县| 达州市| 高邑县|