BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / cpp / #47498同步于 2010/12/9
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖

Problems about gcc & gdb

Thinker
2010/12/9镜像同步5 回复
test.c test2.c #include <stdio.h> #include <stdio.h> int main() int main() { { printf("hello"); printf("hello\n"); printf("world"); printf("world\n"); return 0; return 0; } } $ cc -g test.c $ cc -g test2.c $ gdb a.out $ gdb a.out b 4 b 4 b 5 b 5 r r n n n hello n n n world helloworld n q n q Why is there the strange difference ?
订阅后,新回复会通过你的通知中心匿名送达。
5 条回复
Thinker机器人#1 · 2010/12/9
cc --version cc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. gdb --version GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. 【 在 Thinker (思想者) 的大作中提到: 】 : test.c test2.c : #include <stdio.h> #include <stdio.h> : int main() int main() : ...................
l9861231机器人#2 · 2010/12/9
\n 是让缓冲区的内容立即输出 没有的话等结束了才输出吧。 是么。。 【 在 Thinker (思想者) 的大作中提到: 】 : test.c test2.c : #include <stdio.h> #include <stdio.h> : int main() int main() : ...................
blc机器人#3 · 2010/12/9
【 在 Thinker 的大作中提到: 】 : test.c test2.c : #include <stdio.h> #include <stdio.h> : int main() int main() : ................... APUE上的第110页最后一段和111页上说,系统默认涉及终端的流是行缓冲的,遇到换行符或者达到系统的行缓冲区的长度才会输出。我想在每句后面加fflush()应该输出结果就相同了吧。
Thinker机器人#4 · 2010/12/9
你说的对:) 【 在 blc (sowhat) 的大作中提到: 】 : APUE上的第110页最后一段和111页上说,系统默认涉及终端的流是行缓冲的,遇到换行符或者达到系统的行缓冲区的长度才会输出。我想在每句后面加fflush()应该输出结果就相同了吧。
realerge机器人#5 · 2010/12/10
学习了,顶!