Something I never learned?

This is a discussion on Something I never learned? within the C++ Programming forums, part of the General Programming Boards category; >but different OS' will respond to it differently Yes, this is generally what is meant by undefined behavior . >windows ...

  1. #16
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >but different OS' will respond to it differently
    Yes, this is generally what is meant by undefined behavior.

    >windows will just terminate the program while some other systems will allow you read access to this memory.
    Then it seems Windows is the better system in this case. I and every other programmer I know would prefer the program to crash in huge, obvious bursts of flame than quietly overwrite memory and maybe linger for years before the bug is found.

    >i already admited to missunderstanding the intent of the question.
    Your example stating that *(p + 2) would work and p[2] would fail when both are exactly the same implies that your misunderstanding runs deeper. If I'm incorrect on that point then further examples where the failing case is perfectly valid should be avoided so as not to confuse me.

    -Prelude
    My best code is written with the delete key.

  2. #17
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    >Your example stating that *(p + 2) would work and p[2] would fail

    no no no, what the example was intended to show is that *(p+2) and p[2] are ways to solve a problem which i though was being asked about in the origional post (obviously i was wrong)(notice in the first comment it says "legit ways of accessing data" which is plural). the 2 comments in the code were not for each line, but rather one entire comment put that way to save space (which i now see was a bad idea). the intent was that these to methods are legit however if you access space that is not yours it will crash.

    >I know would prefer the program to crash in huge, obvious bursts of flame than quietly overwrite memory

    now your making the mistake i made initially, the program can not overwrite the read only memory. am i gonna jump all over you about making a mistake as you have been with me? no, im a bigger person than that. i am sorry if i havent been clear ( and i admit i havent) but people do make mistakes and missunderstand things from time to time. you should learn to relax a little.

  3. #18
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >am i gonna jump all over you about making a mistake as you have been with me? no, im a bigger person than that.
    It's fine if you choose to interpret correction as "jumping all over you", I would have seen it as help to correct my statements if they were wrong or my wording if it was ambiguous. I did, however, miss a valid point, thank you. I'll correct myself now.

    >windows will just terminate the program while some other systems will allow you read access to this memory.
    Your claim is unfounded. First, the undefined behavior means that anything could happen, making a reproducable test impossible regardless of the operating system in question. But if you consider such tests valid, my Windows machine doesn't crash the program when I try to access memory I don't own.

    >you should learn to relax a little.
    I'm prefectly relaxed, perhaps you read between the lines somewhere.

    -Prelude
    My best code is written with the delete key.

  4. #19
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    >I would have seen it as help to correct my statements if they were wrong or my wording if it was ambiguous.

    i dont think ambiguous does justice to how horribly unclear my explanations were. to make things worse, the more i tried to clarify what i was saying, the more unclear i made things and in the end i look like the first year un-edumicated babling fool.... oh well, i have to take the stress of midterms out somewhere! i think (?) by now you've got the idea of what i was trying to say initially (hopefully) but either way, im not going to try to explain it again. i rather like this board and do not want to start getting on peoples bad side over missunderstandings such as this.

    in the words of bob marley: "nutin but peace, luv, 'n unity"

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Where to go once you've learned C++?
    By thetinman in forum Tech Board
    Replies: 25
    Last Post: 12-06-2006, 06:54 AM
  2. Learned the basics, SO ?
    By TuxPayne in forum C Programming
    Replies: 4
    Last Post: 09-11-2005, 12:32 PM
  3. Love - learned or inherent?
    By axon in forum A Brief History of Cprogramming.com
    Replies: 42
    Last Post: 01-24-2005, 11:09 AM
  4. Learned optimism
    By Terrance in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 09-25-2003, 03:06 PM
  5. What have you learned?
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-01-2002, 11:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21