This is a discussion on Problem with ctime within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by Elysia Right. So why bother with C functions where there is a better C++ alternative available? But ...
Don't even ask. You do this every time someone has anything to say about random things you recommend, no matter how well intentioned you are or they are.
if you run a program once and it works in every path. it will always work until you change it.
therefore, behavior is only undefined until you test it. once you test it and it works it will do the same thing every time, until you change it.
however, if there is an external variable behavior can be undefined because the variable will affect the program, BUT then the behavior for the program is defined, but it relies on the variable.
plz argue this. i want to see what points you will use
Last edited by bobknows; 03-03-2011 at 06:28 PM.
I am so freaking glad that you've told me.
I'm serious; I will never have to track down undefined behavior ever again. I'm so happy!
well, you still have to debug.
when you get "undefined behavior" you have something that looks like it would work but varies from system to system. this can still can cause problems. most of the point of my argument was that "undefined behavior" is a misnomer. if it does it correctly once it will work correctly until a variable is changed
You have no idea what you are talking about. I know from your posts that you are a newbie. There is nothing wrong with that, but please stop offering such statements as if you know something. It might be the case that another newbie comes along and believes you.
The phrases "undefined behavior" and "the behavior is undefined" appear in the C++ standard document to describe situations where the standard committee chose not to require a particular behavior. In practice, this means that a platform is allowed to do virtually anything in those situations. It may be that, for any given case of undefined behavior, the platform does define the behavior as an extension to the standard, but that need not be the case.
In the real world employing undefined behavior may result in seemingly random crashes. This is simply the nature of the beast.
Feeding invalid values, outside the range or domain, to the standard library functions is undefined behavior, and depending on the state of the system, outside the program environment, your program may or may not crash even if the program environment is exactly the same.
Last edited by phantomotap; 03-03-2011 at 07:00 PM. Reason: none of your business