gcc等同于#pragma注释 [英] gcc equivalent of #pragma comment

查看:177
本文介绍了gcc等同于#pragma注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个宏,用gcc编译器向可执行文件添加注释。这不是为了链接的目的,我只是想添加文本注释。是否有一个#pragma注释等同于gcc为此目的?

I'm trying to write a macro that adds a comment to an executable with the gcc compiler. This is not for linking purposes, I simply want to add text comments. Is there a #pragma comment equivalent in gcc for this purpose?

推荐答案

我不知道这是什么意思注释到可执行文件。谁或什么将消费,显示,甚至注意这样的评论?然而,如果你只是想确保一些字符串被嵌入你的程序中的某个地方,那么只需在文件范围内声明为一个普通(C)字符串。

I'm not sure what it means to "add a comment to an executable". Who or what is going to consume, display, or even notice such comments? Nevertheless, if you just want to ensure some string is embedded somewhere in your program, then simply declare it as an ordinary (C) string at file scope.

static const char my_comment[] = "This comment should appear in the compiled executable";

这篇关于gcc等同于#pragma注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆