原始缓冲区:包括自动生成的文件

发布于 2025-01-26 03:05:11 字数 276 浏览 1 评论 0原文

我设计了一个基于Google原始缓冲区的界面。我还有其他使用此接口的项目(C ++)。为此,我包括自动生成的(由原始缓冲器编译器)和源文件。这是好习惯吗?

我面临的问题是,每次我更改proto接口中的文件名时,其他项目中的包含无效。使用“伪造”(即:包含自动生成文件的标题文件)在原始界面中构建附加层是一个好主意,然后将这些标头文件包括在其他项目中)或其他一些项目或其他一些项目主意?这样,我只需要更改原始界面本身中的其他层,而其他项目将保持不变。

基本上,我不确定如何设计此操作以在接口中具有一些向后兼容性。

I designed an interface based on Googles Proto Buffers. I have other projects (C++) which use this interface. To that end, I include auto-generated (by the proto buffers compiler) headers and source files. Is this good practice?

The problem I'm facing is that, each time I change a name of a file in the proto interface, the includes in the other projects are invalid. Would it be a good idea to build an additional layer in the proto interface with "fake includes" (i.e.: header files which include the auto-generated files, and those header files would then be included into the other projects), or some other idea? That way, I would only have to change that additional layer in the proto interface itself, and the other projects would remain untouched.

Basically, I'm not sure how to design this in order to have some backward compatibility in the interface.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文