Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: The behavior is [sic] undefined

by BrowserUk (Patriarch)
on May 19, 2009 at 00:50 UTC ( [id://764795]=note: print w/replies, xml ) Need Help??


in reply to Re^3: The behavior is [sic] undefined
in thread The behavior is [sic] undefined

Note the 's' on implementations.

That's typically labelled as implementation defined. Which is not the same as undefined behaviour.

Care to differentiate between them?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^5: The behavior is [sic] undefined
by JavaFan (Canon) on May 19, 2009 at 01:23 UTC
    Specification of language X says:
    1. The behaviour of ~0 is implementation defined, but may not be positive.
    2. The behaviour of 0^0 is undefined.
    Implementation S specifies that ~0 equals -1. Implementation T specifies that ~0 equals 1. Neither defines what 0^0 means. Program P contains ~0. Program R contains 0^0. Running P on S produces -1. Running R on S locks up the OS requiring a reboot. S is confirming. Running P on T produces 1. Running R on T produces an error message. T is not confirming.

    Implementation defined means that the feature is a valid feature, and it's up to each implementation to define what it means. Undefined behaviour basically means the feature is not valid, and implementations do not define what happens.

    But let me guess, you're still going to claim to not understand the difference, right?

      Specifications specify, they do not define. Define is defined as: To describe, explain, or make definite and clear;. You cannot define what will be; only what is.

      Implementations do not define, they implement. If they implement the specifications incorrectly--whether by design or error--the resultant behaviour does not meet the specification and so is not conforming; but the behaviour, whatever it may be, still exists. And by recording that behaviour, that behaviour is defined. Right or wrong, the behaviour is described; explained; made definite and clear. Conformant or not, that implementation's behaviour is defined by what actually happens.

      Just as a child's behaviour is defined (described, explained etc.), by what they actually do; not by what his mother says they should or will do.

      If specifications defined, then no implementation could ever be in error. Not just unreasonable or illogical, but impossible.

      If implementations defined, then the first implementation's choices--bugs'n all--would forever preclude any other implementation from doing anything different--whether by design or error. Again, unreasonable, illogical and impossible.

      There is a world of difference between "implementation defined" (which should almost certainly be "implementor's define" or better "decide"), and 'defined by the implementation'.

      The former implies predefinition. And the very existance of that word implies that before-the-fact decisions are quite different from after-the-fact determinations.

      But let me guess, you're still going to claim to not understand the difference, right?

      Wrong! I understand the difference that the two phrases are intended to signify. My hope was that the process of trying to differentiate the phrases in writing would make their failure to meet those intents, as clear to you as they are to me.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://764795]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found