程序开发

发布于 2024-09-26 21:46:05 字数 279 浏览 3 评论 0原文

我正在写一个C程序。从我之前的经验来看,我对程序的正确版本进行了一些更改,而在更改之后,程序计算不正确。

现在,在某些情况下,可能很容易检测到我在哪里进行了更改并撤消它或以其他方式进行更改,而在其他情况下,我发现很难(费力)检测到问题到底出在哪里。

您能否建议一些平台或工具,它允许您将程序的新版本和旧版本并排放置,并标记新版本上采用的更改。

我正在使用 gcc 4.3.2 在 Ubuntu 10.04 操作系统上编译 c 程序。

欢迎任何建议。

问候, 阿努普

I am writing a C program. What I have seen from my earlier experiences is that I make some changes on a correct version of my program, and after that change, the program is computing incorrectly.

Now, for one occasion it may be easy to detect where I made that change and undo it or do it in some other way, and for other occasions I find it hard (with labor) to detect where exactly the problem is.

Can you suggest some platform or tool which allows you to put the new version and old version of the program side by side and mark the changes that were employed on the new version.

I am using gcc 4.3.2 to compile c programs on Ubuntu 10.04 OS.

Any suggestion is welcome.

regards,
Anup

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

耳根太软 2024-10-03 21:46:05

使用版本控制系统。我推荐颠覆。这将允许您将新版本与旧版本进行比较,以准确了解发生了什么变化,并且如果您破坏了代码,您可以恢复到旧的工作版本。

Use a version control system. I recommend Subversion. This will allow you to compare your newer version with the older one to see exactly what changed and you can revert to the older working version if you break your code.

雨的味道风的声音 2024-10-03 21:46:05

如果你想要一个微型、小型、便携、单文件的个人控制版本系统,我可以建议fossil。此处提供文档

If you want a tiny, small, portable, one-file personal control version system, I can suggest fossil. A documentation is available here.

书信已泛黄 2024-10-03 21:46:05

您所要求的是一些类似 diff 的工具。此类工具有很多,从 diff 命令行实用程序到 GUI 前端,例如 http ://meld.sourceforge.net/。这些工具中的大多数都可以与 Subversion 等版本控制系统结合使用(或在其中拥有对应工具)。

What you are requesting is some diff-like tool. There is a plethora of such tools, ranging from the diff command line utility to GUI frontend such as http://meld.sourceforge.net/. Most of these tools can be combined with (or have counterparts in) revision control systems as Subversion.

苏璃陌 2024-10-03 21:46:05

我会使用一些版本控制系统来做到这一点,例如Git。如果您是,请参阅Git 初学者:权威实用指南版本控制系统和/或 git 的新手。

I would do this with some version control system, like Git. Refer to Git for beginners: The definitive practical guide if you're new to version control systems and/or git.

不弃不离 2024-10-03 21:46:05

这就是所有版本控制管理软件的主要目的。
我建议查看 Subversion、GIT 或 Mercurial。

该程序有数千个互联网资源。

他们的 GUI 工具中都集成了很好的比较程序。

Thats the main purpose of all the version control management software.
I recommand to look at Subversion, GIT or Mercurial.

There are thousands of internet resources for this programs.

And they all have good comparision programs integrated in their GUI Tools.

花开雨落又逢春i 2024-10-03 21:46:05

另外,尝试将 Git/Mercurial/其他任何东西与 Dropbox 一起使用,它将允许您继续在其他计算机上进行开发。它还将教您如何与他人以及与自己合作。

使用 Git 和 Mercurial 等较新的 VCS 系统,这会稍微容易一些。

Also, try to use Git/Mercurial/whatever together with Dropbox, it will allow you to continue developing on other computers. It will also teach you how to collaborate with others and with yourself.

This is slightly easier to do with the newer VCS systems like Git and Mercurial.

吾性傲以野 2024-10-03 21:46:05

如果您使用版本控制系统,例如GitMercurial,并遵循一些良好实践

  • 提交小的、独立的更改(包括提交,即通常保存对版本控制的更改)
  • 提交已知的良好状态(或者至少尝试,例如确保代码在提交之前编译)

您将始终能够返回到已知的良好状态。

如果错误存在于您当前的更改中,您可以将当前状态与以前的版本进行比较:更改的行中的某处存在错误...或者更改的行中的某些内容发现了现有的错误。

如果 bug 是由某些早期的、未知的提交引入的,您可以使用 bisect 搜索历史记录以查找显示给定 bug 的第一个提交:例如,请参阅 git bisect 联机帮助页。

华泰

If you would use a version control system, such as Git or Mercurial, and follow a few good practices:

  • committing small, self contained changes (which includes committing, i.e. saving changes to version control, often)
  • committing known good state (or at least trying to, e.g. ensuring that code compiles before you commit)

you would be always able to go back to known good state.

If bug is/was in your current changes, you can compare current state with previous version: somewhere in changed lines there is bug... or something in changed lines uncovered an existing bug.

If bug was introduced by some earlied, unknknown commit, you can use bisect to search through history to find first commit that exhibits given bug: see for example git bisect manpage.

HTH

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文