#include <stdio.h>
#include <stdlib.h>
int main(void) {
long size = 10000000;
long i = 0;
while (i < size) {
printf("%d\n", i);
i++;
}
return EXIT_SUCCESS;
}
/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++
but commenting out printf, i get no error - even traced in a debugger and jumping to breaks after the while loop, i am able to get i reach the 10 billion mark.
just like below -
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
#include <stdio.h>
#include <stdlib.h>
int main(void) {
long size = 10000000;
long i = 0;
while (i < size) {
//printf("%d\n", i);
i++;
}
return EXIT_SUCCESS;
}
2
A
回答
3
您正在使用錯誤的說明符long
它調用未定義行爲的SIGSEV故障。改爲使用%ld
。
2
0
你的調試器應該能夠提供一個回溯,所以你可以看到的是在堆棧的頂部什麼功能的(即當前正在運行)段錯誤的時間。在gdb中,這將是bt
commnd。
+0
你是對的丹 - 我需要查看程序堆棧並檢查在我的環境中導致段錯誤的原因... – knostika
相關問題
- 1. 是什麼原因造成process.hrtime()掛在
- 2. 查看原因
- 3. ,看看是誰造成了發佈?
- 4. ExpectedException造成原因?
- 5. substr()奇怪的輸出。這是什麼原因造成的?
- 6. 是什麼原因造成我的內存泄漏的OpenCV
- 7. Tumblr邊欄更改大小(這是什麼原因造成的?)
- 8. Python的MySQLdb的錯誤 - 是什麼原因造成這種
- 9. 在android webView中造成這種情況的原因是什麼?
- 10. 發現是什麼原因造成這個Windows小工具
- 11. 是什麼原因造成的EXC_CRASH上拋出:異常?
- 12. 是什麼原因造成我的空指針異常
- 13. CSS:造成這種差距的原因是什麼?
- 14. 是什麼原因造成「無法解析佔位符」
- 15. 這是什麼原因造成的? StackPanel滾動問題
- 16. $ .post()jquery方法超時是什麼原因造成的
- 17. 是什麼原因造成在這個博客上
- 18. Simperium 409錯誤,是什麼原因造成的?
- 19. 堆棧損壞,不知道是什麼原因造成的
- 20. 不知道是什麼原因造成的
- 21. 不知道是什麼原因造成我插過載弄亂
- 22. 是什麼原因造成線程異常 「主要」 java.lang.ArrayIndexOutOfBoundsException:5
- 23. css - 這可能是什麼原因造成的?
- 24. 是什麼原因
- 25. pdf4net無法看到原因
- 26. 想看看是在Microblaze的
- 27. BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE的原因是什麼?
- 28. PlatformID.MacOSX是什麼原因?
- 29. 'System.IO.IsolatedStorage.IsolatedStorageException'的原因是什麼?
- 30. RejctedExecutionException的原因是什麼?
好的建議 - 但只是做了 - printf(「%ld \ n」,i); - 仍然我seg段... – knostika
我知道這是一個非常簡單的事情 - 我只是困擾,因爲我正在達到的限制... – knostika
順便說一句,我使用glibc ... – knostika