关于相同头文件的不同版本 [英] About different versions of the same header files

查看:103
本文介绍了关于相同头文件的不同版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI all,

假设我有一个庞大的代码库,而且我有一个非常常见的头文件。

现在有多个地方可以保存这个头文件。


此头文件无法计算,因为它具有不同的功能

原型在不同的地方。

现在可以有一个在编译时保护不同的头文件中的#defines

是相同的。


即假设我在其中一个头中添加了一个新类型文件,然后想要

编译失败的其他目录中有头文件

具有相同的名称,除非所有#defines都相同。

HI all,
Suppose I have a huge code base, And I have a very common header file.
Now there are mulitple places where this header file is kept.

This header file cannot be factored as it has different function
prototypes in different places.
Now can there be a safeguard at compile time to maintain the #defines
in the different headers files to be same .

ie suppose I add a new type in one of the header files and then want
that compile fails in the other directories which has the header file
with the same name, unless all the #defines are same in all.

推荐答案

pa ***** ***@hotmail.com 写道:

HI all,

假设我有一个巨大的代码库,而我有一个非常常见的头文件。

现在这里有多个地方保存文件。
HI all,
Suppose I have a huge code base, And I have a very common header file.
Now there are mulitple places where this header file is kept.



为什么?保留一份副本。


其余的更多是源代码管理问题,而不是C代码。如果

你必须支持多个版本,请使用一个不错的SCM工具。


-

Ian Collins。

Why? Just keep one copy.

The rest is more of a source code management problem than a C one. If
you have to support multiple versions, use a decent SCM tool.

--
Ian Collins.


我们正在使用perforce。

我想把它们全部作为链接。

但无论做了什么伤害都无法做到轻松收回

(需要付出很多努力)


所以,继续前进,是否可以通过检查来阻止这种/>
tomfoolery

-Parag

We are using perforce.
I thought of making all of them as links.
But Whatever damage has been done cannot be taken back that easily
( will take a lot of hard work )

So , going forward, can there be checks to stop this kind of
tomfoolery
-Parag


请保留足够的消息,为您回复消息

有意义。

pa ******** @ hotmail.com 写道:
Please retain enough of the message you are replying to for you message
to make sense.

pa********@hotmail.com wrote:

我们正在使用perforce。

我想把所有这些都作为链接。

但是无论做了什么伤害都不能轻易收回

(需要付出很多努力)


所以,前进,可以有che cks停止这种

tomfoolery
We are using perforce.
I thought of making all of them as links.
But Whatever damage has been done cannot be taken back that easily
( will take a lot of hard work )

So , going forward, can there be checks to stop this kind of
tomfoolery



正如我所说,不要复制文件,共享一个实例。


-

Ian Collins。

As I said, don''t copy the file, share one instance.

--
Ian Collins.


这篇关于关于相同头文件的不同版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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