Monday, July 14, 2008

fflush

fflush(NULL) is my new best friend. I *knew* there was a way to flush the output buffer, I just hadn't had time to properly google it the last time students asked me for help debugging.

One thing about this help centre job... all that C/C++ that was lost in hazy memory is coming back to me. ;)

(Now, if only students would properly indent their code, it would make helping them *so* much easier. I always nag them, and they always say that it takes too much time... little do they realize just how much time they *waste* by trying to track down wayward close braces with improperly formatted code. *sigh*)

9 comments:

sara said...

Is this post in English? :-)

Mathgirl said...

I don't know how people do anything without properly indenting their code. The code I'm working on at the moment is somewhere around 30 pages long and growing daily. I'd shoot myself if it wasn't indented so that opening and closing brackets line up. Have I ever mentioned how much I heart textpad for the formatting?

noricum said...

Part was in English, the rest in C. ;)

I don't understand how people can not use proper formatting either. I don't think they'll make it far in computer science... either that, or they'll *learn* the hard way that formatting is important.

Nicoya said...

Computers are very good at monotonous and repetitive tasks like indenting code.

Truly they are a wonder of this modern age.

noricum said...

Yes, they are. However, students are even better at overriding the natural indentation provided by the software they are using. It is truly astounding!

Anonymous said...

well, the definition of "properly indented" does vary from person to person. ;) that said, I find it funny that when I open up code at work, I can tell QUICKLY if I wrote it or if someone else did based upon the use of whitespace and indentation. One of my teammates is starting to follow my lead though, after finding my code easier to read. ;)

noricum said...

I can handle differences in definition of "properly indented"... what I *can't* handle is completely random uses of tabs and spaces. And believe me, some of these students truly do use *random* indentation. (Need a random number generator? You could probably write one that uses my student's code...)

LadyLinoleum said...

I always forget my end brackets...LOL.

noricum said...

Using proper indentation helps you remember them. ;)