易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux 编程段错误(segmentation error)总结

   最近一段时间在linux下用C做一些学习和开发,但是由于经验不足,问题多多。而段错误就是让我非常头痛的一个问题。不过,目前写一个一千行左右的代码,也很少出现段错误,或者是即使出现了,也很容易找出来,并且处理掉。
    那什么是段错误?段错误为什么是个麻烦事?以及怎么发现程序中的段错误以及如何避免发生段错误呢?
    一方面为了给自己的学习做个总结,另一方面由于至今没有找到一个比较全面介绍这个虽然是“particular problem”的问题,所以我来做个抛砖引玉吧。下面就从上面的几个问题出发来探讨一下“Segmentation faults"吧。
目录
1。什么是段错误?
2。为什么段错误这么“麻烦”?
3。编程中通常碰到段错误的地方有哪些?
4。如何发现程序中的段错误并处理掉?
正文
1。什么是段错误?
下面是来自Answers.com的定义:
Quote:
A
segmentation fault (often shortened to segfault) is a particular error
condition that can occur during the operation of computer software. In
short, a segmentation fault occurs when a program attempts to access a
memory location that it is not allowed to access, or attempts to access
a memory location in a way that is not allowed (e.g., attempts to write
to a read-only location, or to overwrite part of the operating system).
Systems based on processors like the Motorola 68000 tend to refer to
these events as Address or Bus errors.
Segmentation is one
approach to memory management and protection in the operating system.
It has been superseded by paging for most purposes, but much of the
terminology of segmentation is still used, "segmentation fault" being
an example. Some operating systems still have segmentation at some
logical level although paging is used as the main memory management
policy.
On Unix-like operating systems, a process that accesses
invalid memory receives the SIGSEGV signal. On Microsoft Windows, a
process that accesses invalid memory receives the
STATUS_ACCESS_VIOLATION exception.
另外,这里有个基本上对照的中文解释,来自http://www.linux999.org/html_sql/3


相关文档:

面向 DBA 的 Linux Shell 脚本简介

DBA:Linux
面向 DBA 的 Linux Shell 脚本简介
作者:Casimir Saternos
学习一些在 Linux 上安装、运行和维护 Oracle 数据库所需的基本 bash shell 脚本。
本文相关下载:
示例脚本
Oracle 数据库 10g
2005 年 11 月发表
大约 7 年前,Oracle 发布了 Linux 上的第一个商业数据库。从那时起,Oracle、Red Hat 和 ......

Linux 内核中的 GCC 特性


M. Tim Jones, 顾问工程师, Emulex Corp.
Linux® 内核使用 GNU Compiler Collection (GCC) 套件的几个特殊功能。这些功能包括提供快捷方式和简化以及向编译器提供优化提示等等。了解这些特殊的 GCC 特性,学习如何在 Linux 内核中使用它们。
GCC 和 Linux 是出色的组合。尽管它们是独立的软件,但是 Linux 完全依靠 ......

制作自己的Linux OS


<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......

Linux开机启动Oracle

在/etc/rc.local中添加
su - oracle "-c dbstart"
在此之前你要确保该命令可以启动你需要的数据库, 需要测试一下
su - oracle "-c dbstart"
dbstart命令正常运行需要配置/etc/oratab,里面可以配置多个数据库实例,每个的格式:
$ORACLE_SID:$ORACLE_HOME:<N|Y>
正常情况下配置好/etc/oratab, dbstart命令就可以正 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号