由于程序运行老是有 Segmentation fault 的错误,即使是象上一篇文章中讲的那样改了,也还是可能碰到,于是上网找了找,发现了这样一些东西。
首先是一段英文的东西,是最先找到的,大概就是说是因为指针,数组的不恰当使用造成分段内存访问时的错误,这里就不翻译了。
One of the most common problems when making software is errors like "Segmentation fault", also called SegFault. Here is what a SegFault is. Virtual memory in a computer can be created in 2 ways: pages or segments. Paging means that the memory is divided in pages of equal size, containing words of memory in it. Segmentation means that every process has a segment of memory of needed size, with gaps of empty memory blocks between the segments. The operating system knows the upper limit of every segment, and every segment begins at a virtual address 0. When a program accesses a memory block, it calls a virtual address that the Memory Management Unit (MMU) maps to a real address. If the operating system sees that the requested address doesn't match any valid address in the segment, it will send a signal to the process terminating it. SegFaults are the direct result of a memory error. The program has a bad pointer, a memory leak or any kind of error that makes it access the wrong memory address. To correct these errors you need to check pointers and arrays for errors.
进一步查找,发现有这样一个帖子,这里我就不帖原文了,大家要看可以到这里看看,应该还是有帮助的
似乎知道问题,那么去解决问题就可以了,但是,去看看那个编译能通过但不能执行的ezx的hello的例子,还是搞不清那个地方就有指针或者数组的错误,先写到这,等问题解决了再来吧。