在MSVC中处理__attribute__ [英] Dealing with __attribute__ in MSVC

查看:80
本文介绍了在MSVC中处理__attribute__的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道使用MSVC时处理包含GCC的 __ attribute __ 扩展名的代码的最佳方法是什么.以下是处理此问题的安全方法:

I was wondering what the best way to deal with code containing GCC's __attribute__ extension when using MSVC. Is the following a safe way of dealing with this:

#define __attribute__(x) /* blank - should simply ignore thanks to C preprocessor */

谢谢!

推荐答案

看看

Take a look at the GCC Manual and find out what each attribute does. Then find out what the MSVC equivalent is. Some can be safely ignored but some you will want the replace.

如果您希望代码成为真正的跨平台代码,请创建自己的宏集,这些宏可以为每个平台正确实现.

If you want you code to be truly cross platform, create your own set of macros that can be implemented correctly for each platform.

这篇关于在MSVC中处理__attribute__的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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