I have a problem compiling application in c++11 mode that can be resolved by simply adding a whitespace character into the header of dbus library.
我在c ++ 11模式下编译应用程序时遇到问题,只需在dbus库的标题中添加空白字符即可解决。
If I do this - will it break stuff when the library I am trying to build (with whitespace'd header) will try to link to dbus (which was built without whitespace in the header) ?
如果我这样做 - 当我试图构建的库(带有空格标题)将尝试链接到dbus(在标题中没有空格构建)时,它会破坏东西吗?
In particular, dbus-protocol.h contains this line:
特别是,dbus-protocol.h包含以下行:
#define DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE "<!DOCTYPE node PUBLIC \""DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER"\"\n\""DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER"\">\n"
where, to successfuly compile in c++11 mode whitespace must be inserted as in:
其中,为了在c ++ 11模式下成功编译,必须插入空格,如下所示:
...PUBLIC \"" DBUS_INTROSPECT...
How much can we really change in a header file without breaking compatibility? (I know of qt ABI compatibility guide but I don't think it addresses my particular question)
在不破坏兼容性的情况下,我们可以在头文件中真正改变多少? (我知道qt ABI兼容性指南,但我不认为它解决了我的特定问题)
1 个解决方案
#1
1
That looks like a bug in that header. Barring some really pathological cases, adding whitespace there will not cause incompatibility, other than avoiding the bug on some compilers.
这看起来像那个标题中的错误。除了一些真正的病态案例,添加空格不会导致不兼容,除了避免某些编译器上的错误。
I am assuming that the DBUS_
... identifier expands to a quote delimited string, which is then supposed to auto concatinate with the rest of that macro. It is a pretty safe assumption.
我假设DBUS _...标识符扩展为引号分隔的字符串,然后该字符串应该与该宏的其余部分自动连接。这是一个非常安全的假设。
#1
1
That looks like a bug in that header. Barring some really pathological cases, adding whitespace there will not cause incompatibility, other than avoiding the bug on some compilers.
这看起来像那个标题中的错误。除了一些真正的病态案例,添加空格不会导致不兼容,除了避免某些编译器上的错误。
I am assuming that the DBUS_
... identifier expands to a quote delimited string, which is then supposed to auto concatinate with the rest of that macro. It is a pretty safe assumption.
我假设DBUS _...标识符扩展为引号分隔的字符串,然后该字符串应该与该宏的其余部分自动连接。这是一个非常安全的假设。