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

Program won't crash when it should

Name: Anonymous 2012-01-16 3:24

(GCC C)
I ran a pointer over each member of an integer array, storing one character of input in each cell.

The program seems to consistently crash when I try to store X+3 or more characters, where X is the size of the array, but if I do not exceed X+2 it will not crash.

Why does it crashes exactly at the point it does, but not for X+1 or X+2?

Name: Anonymous 2012-01-16 20:20

>>78

The one you visibly don't have a single clue about? Sure.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-16 20:21

One could never argue, for example, that a fwrite() which happens to write to a dying hard disk
is "underfined behavior",

You're mixing up the implementation with the "C Abstract Machine".

Name: Anonymous 2012-01-16 20:23

Well from the standard:
The printf function is equivalent to fprintf with the argument stdout interposed before the arguments to printf.

The fprintf function returns when the end of the format string is encountered.

So the program terminates after printf returns and stdout is flushed and closed.

Name: Anonymous 2012-01-16 20:23

jews

Name: Anonymous 2012-01-16 20:24

>>79
I can't right now because I'm not on my *nix box -(.

Name: Anonymous 2012-01-16 20:25

>>82

Actually you're the one which seems to be mixing these two things up, as per >>63.

Name: Anonymous 2012-01-16 20:26

>>22
This is not the case here and a non-deterministic compiler wouldn't prove very useful.

Name: Anonymous 2012-01-16 20:26

>>85
Still are you certain that you are correct in this example, given the information in >>83? If a flush on stdout is sufficient for it to not block the pipe then the program in >>40 certainly does not block as printf returns and stdout is flushed and closed after return 0; is encountered in main.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-16 20:31

>>86
No you annoying stupid shit. All the standard states is that the implmentation must be such that its behavior corresponds to the C Abstract Machine. That means

One could never argue, for example, that a fwrite() which happens to write to a dying hard disk
is "underfined behavior", or that an auto int x; which happened to be allocated on a failing memory circuitry during execution is "undefined behavior".

Would be legal as long as the behavior of the implementation was the same as the C Abstract machine.

Name: Anonymous 2012-01-16 20:33

>>86
No you annoying stupid shit. All the standard states is that the implmentation must be such that its behavior corresponds to the C Abstract Machine. That means


>One could never argue, for example, that a fwrite() which ?>happens to write to a dying hard disk
>is "underfined behavior", or that an auto int x; which >happened to be allocated on a failing memory circuitry during >execution is "undefined behavior".

Would be legal as long as the behavior of the implementation was the same as the C Abstract machine.

Name: Anonymous 2012-01-16 20:35

>>89

What the fuck are you talking about, you brutish retard?

You're the one which provided a ridiculous and defective example, cited "pipe blocking" issues to justify your failure and now is trying to fix your own argument with something a dozen people has already told you: the C standard does not give a fuck about pipes or terminals, dumbass. The program is completely correct.

Name: Anonymous 2012-01-16 20:38

>>91
I'm summarizing what ISO says regarding the implementation itself you mental midget.

Also, the program isn't correct. Again, I think I'm gonna have to start giving some concrete examples, because once again, you're getting your panties in a bundle.

Name: Anonymous 2012-01-16 20:41

Failure to output the string you put in printf immediately doesn't produce any undefined behavior, failing to do so on program termination does however. There is no shall requirement that is violated here.

Name: Anonymous 2012-01-16 20:45

>>92

So the program is not correct. Lol.

You're simply intelectually impaired to go anywhere further this  point. And stubborn as a spoiled girlie.

Just fuck off. Stop wasting everyone's time and go back to Wal Mart.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-16 20:46

>>91

C99 7.19.2p2 says:


    A text stream is an ordered sequence of characters composed into _lines_, each line consisting of zero or more characters plus a terminating new-line character. Whether the last line requires a terminating new-line character is implementation-defined.


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

Name: Anonymous 2012-01-16 20:47

>>94
Shut up and learn something from this thread you fucking moron.

Name: Anonymous 2012-01-16 20:50

>>40
This program is correct and does not feature any undefined behavior.

<stdio.h> is included so printf is defined as per the C standard library

The printf function is equivalent to fprintf with the argument stdout interposed before the arguments to printf.

The fprintf function returns when the end of the format string is encountered.

The return 0 in main is equivalent to calling exit with 0 as an argument which will flush all open streams with unwritten buffered data then close all open streams.


The requirement is that "At program termination, all data written into files shall be identical to the result that execution of the program according to the abstract semantics would have produced.", since stdout is flushed and closed the program writes the same data to stdout as the C abstract machine would at program termination so it's a conforming implementation.

Name: Anonymous 2012-01-16 20:52

>>97

C99 7.19.2p2 says:


    A text stream is an ordered sequence of characters composed into _lines_, each line consisting of zero or more characters plus a terminating new-line character. Whether the last line requires a terminating new-line character is implementation-defined.


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

Name: Anonymous 2012-01-16 20:53

>>98
Your point is moot, nothing violates that requirement.

Name: Anonymous 2012-01-16 20:54

>>99
How do you figure?

Name: Anonymous 2012-01-16 20:58

>>100
And what happened to all toilets scrubbers that were arguing with me? Exactly. Non of you mental midgets can say jack shit now. With that, I think you all need to go run off and 'lol' with your fellow retards.

Name: Anonymous 2012-01-16 21:00

>>89
>>90

Haha. I lawl'd.

It seems the Kodak guy needs some samefagging support to give his opinions some more bulk.

>>95
>>96

...Ain't that so? :)

Dude, now I feel really sorry for you. You're such a loser.

Don't take my offenses personal anymore, you really need some friendship and caring.

Name: Anonymous 2012-01-16 21:01

>>100,101
What you posted only shows that no lines are written to stdout, this doesn't exactly change anything, as the data is still written to stdout at program termination in the same manner as the C abstract machine would do it.

Name: Anonymous 2012-01-16 21:04

>>102
Is that the best response you can give you fucking moron? Ya know, most people would try and rebutt me with a sound technical argument. However, the fact that you can't only reinforces my belief that you're a complete and total dumbass with no future as a computer programmer.

Name: Anonymous 2012-01-16 21:04

>>103
So to clarify, what you cited from the standard just shows that the data written might not be a line as defined per the C standard, but what >>97 shows is that the data is indeed written.

Name: Anonymous 2012-01-16 21:07

>>103
That's assuming the program terminates.

Name: Anonymous 2012-01-16 21:08

>>106
So in other words, it's undefined behavior.

Name: Anonymous 2012-01-16 21:10

>>106
What's keeping it from terminating? After all printf returns when it reaches the end of the format string. I suppose you could suspend it with a signal, but that still isn't undefined behavior as long as it's also valid input for the C abstract machine.

Name: Anonymous 2012-01-16 21:11

>>103
How come you don't seem to have any issues understading the concept of the C abstract machine? Just curious because the other person who is calling me a a loser can't seem to grasp what is going on.

Name: Anonymous 2012-01-16 21:12

>>109
I don't know, perhaps he's a mental midget or something.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-16 21:13

>>108
I find it kind of interesting that you seem to grasp what is going on, but >>102 doesn't.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-16 21:14

>>110
I guess so.

Name: Anonymous 2012-01-16 21:20

I wonder why Kodak is so angry all the time. I wonder if he has some psychological condition or it's just his personality, not that it matters, but it can't be very pleasant or relaxing to constantly insult people (who don't even feel insulted by his insults) or be constantly angry, his replies seem to have this attitude regardless if the one he is responding to is correct or wrong, actually he tends to almost always argue against what is being said regardless of the correctness of the post or criticism in question, usually the only thing required to qualify such a response seems to be that the post he responds to be a response to his own post, is this because he thinks his posts cannot ever be wrong(is it pride, but why?)? not taking advantage of the natural human self-correcting/learning abilities is a grave mistake, this might leave him open to ridicule when the one he is calling names actually has a correct position.

As a sidenote, for someone who insults so much, he sure loves reusing his stock insults centered around toilet cleaning, someone's programming industry job prospects and someone's mental faculties.

If I didn't include this line, he'd also assume this post was written by the person he was arguing with now (I'm not).

Expecting insulting response which is incapable of actually insulting me as he chose to form a persona here, which means someone will tend to form an opinion on him which biases how they see his posts, instead of just judging a post's worth by the content only. Needless to say, my opinion of him is somewhat low at the moment, but it could rise if he actually chose learning over pride and integrity over job whoring.

Name: Anonymous 2012-01-16 21:21

>>109
How come you don't seem to have any issues understading the concept of the C abstract machine?
Such a device can only be Jewish in origin, so to understand it he must either be Jewish or brainwashed by Jewish academia.

Name: Anonymous 2012-01-16 21:23

>>104

Many answers have already been given to you, of several technical dimensions. Yet you still ignore responses you receive, intentionally adding confusion with your multiple impersonations and with your gratuitously uneducated responses.

There is no undefined behavior in the original program. Data will be flushed in program termination as though as fflush() was called. There is no violation of any clauses in any part of the code. Environmental influences of the sort I've described do not trigger undefined behavior as erroneous language constructs or erroneous execution paths do. There's nothing else to discuss on that matter.

You confuse a lot of things: implementations, abstract machines and language semantics. Summed up with your general lack of posture, it is surely a discussion not worth going any further, since it has seemingly become a matter of personal honor for you to "win" such a debate.

I'd surely not worry about my future. But what about yours?

For real: you need friendship and support, and maybe even some therapy. You won't go very far with your attitude. >>109, >>110: Your multiple personalities are rather pitiable. Don't you realize you've already debunked yourself?

Name: Anonymous 2012-01-16 21:24

>>114
Do you always translate the word 'abstract' to that nationality/religion? You don't consider anything that isn't directly accessible to senses real in any sense, do you?

Name: Anonymous 2012-01-16 21:26

>>113
but it can't be very pleasant or relaxing to constantly insult people
I do this now and again and I'll tell you, it feels great! The problem is that you become so committed to your earlier statements that there is no way that you can acknowledge that any of them are wrong without losing all credibility. Kodak is mostly right but he also get certain things wrong now and again, of course he denies that he's ever wrong either because he's too committed or because he actually thinks he's right.

Name: Anonymous 2012-01-16 21:28

>>115
I'm not Kodak and I wrote >>110 in response to >>109, I'm not a personality of Kodak if that's what you're implying.

Name: Anonymous 2012-01-16 21:29

>>115
Which part of the following

C99 7.19.2p2 says:


    A text stream is an ordered sequence of characters composed into _lines_, each line consisting of zero or more characters plus a terminating new-line character. Whether the last line requires a terminating new-line character is implementation-defined.


Don't you understand?

Name: Anonymous 2012-01-16 21:30

>>116
Actually I'm not ``that guy'' who constantly shitposts about all things abstract and Jewish, I was just joking.

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