Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

For you

Name: Anonymous 2012-01-12 14:20

What is the output of this program and why?

#include <stdio.h>

void f(void) {
  printf("hax my anus\n");
  fflush(stdout);
  f();
}

int main(void) {
  f();
  return 0;
}

Name: Anonymous 2012-01-12 15:19

>>79
Implying that we can't argue about the obvious.

Name: Anonymous 2012-01-12 15:20

>>79
The correct solution was already given in >>3.

Name: Anonymous 2012-01-12 15:20

HERP DERP THE PROGRAM IS UNDEFINED SINCE IT RELIES ON UNDEFINED BEHAVIOR AND IT ONLY RUNS THAT WAY IF COMPILED WITH GCC

I am of course referring to the Segmentation fault output the program ultimately produces on a x86

Name: Anonymous 2012-01-12 15:21

>>82
It doesn't run "forever".

Name: Anonymous 2012-01-12 15:21

>>83
Actually this is a well defined program that doesn't rely on any compiler.

Name: Anonymous 2012-01-12 15:21

>>84
Yes it does, if it doesn't then your implementation of C is flawed.

Name: Anonymous 2012-01-12 15:22

It depends on OP's premise: Is he referring to the output he gets on his machine, or from a "correct" implementation of C? In the first case it relies on undefined behavior that ultimately results in a Segmentation fault. Clever troll. Now go back to /g/

Name: Anonymous 2012-01-12 15:22

>>85-86
It depends on OP's take

Name: Anonymous 2012-01-12 15:22

>>83
On my x86 computer it doesn't stop executing.

Name: Anonymous 2012-01-12 15:23

>>86
Even with a non-flawed implementation, the program might be interrupted by a signal correct?

Name: Anonymous 2012-01-12 15:24

>>89
It does on mine

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-12 15:24

>>76
I'm actually a Java Programmer, but anyways.....

Unless things have changes, fflush() itself is a (circular) linked list. When this function gets called, it will check against the "base". If the "base" is NULL, it will call malloc(). Otherwise it will do some kind of write().

Name: Anonymous 2012-01-12 15:24

>>91
Then your implementation of C is flawed get a conforming compiler.

Name: Anonymous 2012-01-12 15:24

>>89
inb4 IM USING A C VIRTUAL MACHINE NOT UR SHITTY COMPLIER

Name: Anonymous 2012-01-12 15:26

Now this is the first time I'm curious as to what Zhivago would say, I'm guessing it would something in line with >>54.

Name: Anonymous 2012-01-12 15:26

>>92
Java Programmer,
inb4 shitstorm fagstorm India

Name: Anonymous 2012-01-12 15:26

Now this is the first time I'm curious as to what Zhivago would say, I'm guessing it would be something in line with >>54.

Name: Anonymous 2012-01-12 15:27

>>92
What the fuck Kodak? What the very fuck.

Name: Anonymous 2012-01-12 15:27

Almost a 100 replies in an hour, /g/, seriously, please leave.

Name: Anonymous 2012-01-12 15:28

Check 'em?

Name: Anonymous 2012-01-12 15:28

>>96
At least I have enough of an idea on how fflush() actually works to make a reasonable guess on the source of the crash you fucking toilet scrubber. Now shut up and go google something.

Again, you're stupid. And again, you have no possible future as a computer programmer.

Name: Anonymous 2012-01-12 15:28

>>101
Ahhhh yeahhhhhh.

I love you Kodak, even though you're a Java programmer.

Name: Anonymous 2012-01-12 15:29

WTF is wrong with you?

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-12 15:30

>>98
I know I'm on the right track.

Name: Anonymous 2012-01-12 15:30

>>101
You have an 'idea'
Now provide some evidance.
But I will abandon my 'computer programmer' aspirations and move onto World Domination as soon as I 1CC some lunatic touhou

Name: Anonymous 2012-01-12 15:32

>>102
Listen you little stupid fucker. Go read "The C Programming Language" by K & R. At the end of chapter 8, there is a programming excercise that asks you to implement fflush().

Now shut up and go scrub another toilet you fucking dumbass.

Name: Anonymous 2012-01-12 15:33

>>105
Read response >>106 you fucking moron.

Name: Anonymous 2012-01-12 15:33

>>106
>K&R
>C standard

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-12 15:34

>>108
No, but the exercise does provide some insight into how fflush() works.

Name: Anonymous 2012-01-12 15:35

>>104
n1124 §7.19.5.3
If stream points to an output stream [...] the fflush function causes any unwritten data for that stream to be delivered to the host environment to be written to the file

Name: Anonymous 2012-01-12 15:36

All the autism because of OP's troll.

Name: Anonymous 2012-01-12 15:36

Again, it's undecidable.

Name: Anonymous 2012-01-12 15:36

>>110
And how much different is that fromt he outline of the code I gave you fucking halfwit?

Name: Anonymous 2012-01-12 15:38

>>109
'Some insight'
I tought precise terms were important to you?

Name: Anonymous 2012-01-12 15:38

>>112
Now go run off and play some internet video game. You clearly don't have what it takes yet.

Name: Anonymous 2012-01-12 15:38

>>114
Go back to /g/ jew

Name: Anonymous 2012-01-12 15:39

>>115
Go back to /g/

Name: Anonymous 2012-01-12 15:41

>>114
Well, you seem to get your panties in a bundle when I call you on your stupidity. Why don't just give your lame a ego a rest, accept that fact that your entire schooling was a waste, and accept that fact you will more than likely not land any kind of programming job when you get out of school.

Name: Anonymous 2012-01-12 15:41

>>95,97
I'm done with this stupid thread and the idiots in it now but Zhivago has a very similar view, see, for example,

http://www.reddit.com/r/programming/comments/nubf4/c11_has_been_published/c3ce1i3

Name: Anonymous 2012-01-12 15:44


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List