国产探花免费观看_亚洲丰满少妇自慰呻吟_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__)這兩個宏定義功能一致,實現稍微有點區別。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 武冈市| 曲松县| 丽江市| 永靖县| 广宗县| 崇州市| 白城市| 尖扎县| 沙河市| 如东县| 遂昌县| 宁波市| 奉化市| 枣强县| 沁水县| 西盟| 沿河| 临桂县| 白银市| 勃利县| 安塞县| 兴城市| 广安市| 达拉特旗| 贵州省| 锦屏县| 清水县| 平山县| 华宁县| 威远县| 仲巴县| 玉田县| 射洪县| 三明市| 疏勒县| 东海县| 商河县| 蓬莱市| 来安县| 微山县| 忻城县|