class object initialisation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Attila Feher

    #76
    Re: class object initialisation

    tom_usenet wrote:[color=blue][color=green]
    >> Nope. An initialized object of any kind *might* contain an
    >> indeterminate value (like initialized by rand()) but it contains a
    >> value which is in the value set of the type for that object (object
    >> in C sense). Uninitialized (auto) PODs do not fullfill this
    >> requirement. If something is not initialized and it might not even
    >> be of its own type is uninitialized.[/color]
    >
    > Being initialized by rand doesn't make something indeterminate, since
    > you can examine its value and hence find out what it is. Indeterminate
    > means that you cannot determine the value, not that you don't know the
    > value.[/color]

    Well, in my poor English vocabulary that is non-determinable. Indeterminate
    is (for me) something we do not know for sure (like what will rand put
    there) but we can find out later. Non-determinable is OTOH something which
    cannot be examined.

    But this whole point is mute: that very POD may not even conform to its own
    requirements. The "value" there is *not* necessarily a value for that type,
    hence it is not initialized.
    [color=blue]
    > Perhaps a better term would be "singular", as used with iterators. So,
    > the standard would say: "An automatic storage POD that does not have
    > an explicit initializer is implicitly initialized to a singular
    > value." or similar, with a description of singular meaning
    > indeterminate, illegal in lvalue-to-rvalue conversions, etc. Makes
    > sense in C++ abstract machine terms, if not entirely in real world
    > terms.[/color]

    I dunno much about that abstract machine, but IMHO it makes much more sense
    to say that it is not initialized. Because that is what happens. It is
    assigned memory (it will become existing as an object - in the C meaning)
    but it is not initialized.
    [color=blue][color=green][color=darkred]
    >>> Also, the standard clearly uses the term "initialization " to
    >>> describe something that happens at object creation, not afterward.[/color]
    >>
    >> I do not care if a later "giving of a correct value" is called
    >> assignment and not initialization. Just be brave and admit that it
    >> is legal to have uninitialized PODs around (as long as they are not
    >> used as an rvalue) and that it is legal to assign a value to an
    >> uninitialized POD, which makes it initialized. PODs can be
    >> initialized "later" than their definition/construction. The
    >> initialization (giving a correct initial value and thereby forming a
    >> valid POD type T) can be done using an assigment.[/color]
    >
    > There are even more catches to this.
    >
    > unsigned char c;
    > c = c; //legal!
    >
    > unsigned char can never have indeterminate values (because all bits of
    > the object representation take part in the value representation) .[/color]

    Where is that required by the standard?
    [color=blue]
    > The existence of PODs in the standard has created a bit of a legalese
    > headache. It is clear though that in order for initialization of
    > non-PODs to mean the same initialization of PODs, the concept of
    > indeterminate but initialized values has to be introduced.[/color]

    The standard seems to mix existing with initialized...
    [color=blue]
    > This is
    > useful elsewhere though: invalid pointers do have indeterminate
    > values, according to the note in 5.3.5/4.[/color]

    Again a bit of a mystery. delete take a *copy* of the pointer. So it
    cannot change it at all. So the value of the pointer *is* determined, we
    exactly know what value it has. Only this value is not to be dereferenced.
    [color=blue]
    > So, the standard text for what you can't do with
    > certain POD objects can't use the term
    > "uninitiali zed" but must use "indetermin ate" or perhaps "singular".[/color]

    Singular I like. :-) Let's bet on this one. It is stunning enough that I
    will stop seeing things like this in code:

    zzz f2( bool &b, YYY y) {
    if (y.w() != 32) return;
    ...
    }

    XXX f(YYY y) {
    bool b;
    ZZZ z = f2(b, y);
    if (b) {
    ...
    } else {
    ...
    }
    }
    [color=blue]
    > Is it really useful to talk about uninitialized
    > PODs then, rather than ones with indeterminate values?[/color]

    Yes. "Indetermin ate value" implies: it is an int, but with some garbage
    value in it; while the truth is: it is a place for an int, with no int in
    it.

    --
    Attila aka WW


    Comment

    • Alexander Terekhov

      #77
      Re: class object initialisation


      Attila Feher wrote:
      [...][color=blue]
      > Indeterminate is ...[/color]

      "either an unspecified value or a trap representation"

      "unspecifie d value

      valid value of the relevant type where this International
      Standard imposes no requirements on which value is chosen
      in any instance

      NOTE An unspecified value cannot be a trap representation. "

      "Certain object representations need not represent a value
      of the object type. If the stored value of an object has
      such a representation and is read by an lvalue expression
      that does not have character type, the behavior is
      undefined. If such a representation is produced by a side
      effect that modifies all or any part of the object by an
      lvalue expression that does not have character type, the
      behavior is undefined***41) . Such a representation is
      called a trap representation.
      ....
      41) Thus, an automatic variable can be initialized to a
      trap representation without causing undefined behavior,
      but the value of the variable cannot be used until a
      proper value is stored in it."

      C "legacy", my friend. ;-)

      regards,
      alexander.

      Comment

      • Attila Feher

        #78
        Re: class object initialisation

        Alexander Terekhov wrote:
        [SNIP][color=blue]
        > 41) Thus, an automatic variable can be initialized to a
        > trap representation without causing undefined behavior,
        > but the value of the variable cannot be used until a
        > proper value is stored in it."
        >
        > C "legacy", my friend. ;-)[/color]

        It is still only a funny way to say: there is memory dedicated to that
        variable (storage dedicated to that object) but that memory is uninitialized
        therefore it may not represent a valid value for the given type. :-)

        --
        Attila aka WW


        Comment

        • Gary Labowitz

          #79
          Re: class object initialisation

          "Attila Feher" <attila.feher@l mf.ericsson.se> wrote in message
          news:bk6jeo$6so $1@newstree.wis e.edt.ericsson. se...[color=blue]
          > tom_usenet wrote:
          > [SNIP][color=green]
          > > I think this highlights the weakness of the standard's use of
          > > "initialize ". Because it has attempted to change the meaning of the
          > > word from the common programming one, the standard itself has become
          > > internally inconsistent, since not everyone was aware of this new
          > > special C++ meaning. There are several other places where this
          > > "mistake" has been made with initialize.[/color]
          >
          > I think otherwise. The standard seems to mix up the two completely[/color]
          separate[color=blue]
          > concepts of initializer (syntax/semantics issue of a language element,
          > needed to be introduced because of the different between a constructor[/color]
          call[color=blue]
          > and an assignment operator call) and the act of initialization. These are
          > separate concepts, and that mistake shows up its ugly head when using PODs
          > (having no constructors):
          >
          > int i = 0;
          >
          > Initializer by the language semantics. Initialization by the act.
          >
          > int i;
          >
          > for (i = 0;...
          >
          > Assignment by the language semantics. Initialization by the act.[/color]

          This looks like fun, so I'll take my stab at it.

          When a variable is made available to a program, the compiler must have
          generated code that sets aside some area of memory for use by the program.
          If the generated code of the compiler also puts a predetermined value in the
          area of memory, this is called initialization. I.e. the memory allocated to
          the variable, if examined with (say) a cout << operation, will show a value
          that the programmer specified in the declaration that requested the
          allocation. However, if the programmer did not specify an initial value in
          the declaration, all bets are off. The initial value of the variable could
          be anything and is usually whatever was in the memory area prior to its
          being used as the variable being declared.

          For certain structures, the compiler will zero-initialize members
          implicitly, without the programmer having to specifically declare an initial
          value. In the case of arrays, for example, if fewer initial values are
          provided than the array can store, zero-initialiation will be done for the
          remaining array elements.

          Once the variable is available to the program, any movement of a different
          value into the variable, such as with an assignment operation, is called
          assignment.
          The entire issue is: What is in the variable immediately after its
          "creation?" If it is a determinate value, specified by the programmer, it
          has been "initialize d" by the compiler.

          [Note: by "memory area" I do not exclude use of registers, data bases, or
          any other mechanism any given compiler chooses to use for variable storage.]

          Does this make sense to anyone?


          Comment

          • Gary Labowitz

            #80
            Re: class object initialisation

            "White Wolf" <wolof@freemail .hu> wrote in message
            news:bk56j0$4c3 $1@phys-news1.kolumbus. fi...[color=blue]
            > Nope. An initialized object of any kind *might* contain an indeterminate
            > value (like initialized by rand()) but it contains a value which is in the
            > value set of the type for that object (object in C sense). Uninitialized
            > (auto) PODs do not fullfill this requirement. If something is not
            > initialized and it might not even be of its own type is uninitialized.[/color]

            Disagree. The type of a variable specifies two things: the size of memory to
            be accessed and the encoding of the bits in that area. As far as I know,
            there are not "invalid" combinations of bits for a type. Whatever is in
            there is interpreted according to the encoding of the type. The value this
            results in is usually garbage, but is still a value of the type.

            Having said that, I wonder if bool types MUST be either all ones or all
            zeros. Would a bool containing mixed bits confuse a formatter (like cout) or
            would it just say "Hmmm, not all zeros --- therefore, true!"
            --
            Gary


            Comment

            • Gary Labowitz

              #81
              Re: class object initialisation

              "White Wolf" <wolof@freemail .hu> wrote in message
              news:bk67pi$kmt $1@phys-news1.kolumbus. fi...
              <<snip>>[color=blue]
              > int i =1; does exaclty the same as
              > int i;
              > i=1;[/color]

              Now this may be the crux of the issue. Is
              int i = 1;
              the same as
              int i;
              i=1;
              ?????
              I'm on unfirm ground here, but in my youth I knew of compilers that treated
              int i = 1; as a statement leading to compiling the area to be used by the
              program into the executable with the value of the area already set to 1.
              This meant that when the program was loaded, so was the area for i, already
              initialized to 1. There was no code run to "initialize " the area; it started
              life with the bits already set for that type's 1.

              Does this happen at all with current C++ compilers? Say, with globals? Or
              constants? (I really don't know, just asking.)
              --
              Gary


              Comment

              • Gary Labowitz

                #82
                Re: class object initialisation

                "Attila Feher" <attila.feher@l mf.ericsson.se> wrote in message
                news:bk6m18$8g1 $1@newstree.wis e.edt.ericsson. se...
                [color=blue]
                > Yes. "Indetermin ate value" implies: it is an int, but with some garbage
                > value in it; while the truth is: it is a place for an int, with no int in
                > it.[/color]

                Still disagree. An int with some bits in it that I didn't know would be
                there ("indetermin ate value") is still an int value. Display it and you will
                see what value of int it is -- and not to your liking, perhaps, but still an
                int. [Translation: all bit combinations in an area declared as an int ARE
                int's.] This is because the compiler generates code that picks up the
                number of bytes it uses for an int and interprets the bits in there as the
                value. Just because you don't know what is in that area doesn't make it not
                an int value.
                --
                Gary


                Comment

                • Gary Labowitz

                  #83
                  Re: class object initialisation

                  "White Wolf" <wolof@freemail .hu> wrote in message
                  news:bk4fn3$s9s $1@phys-news1.kolumbus. fi...[color=blue]
                  > tom_usenet wrote:
                  > [SNIP][color=green]
                  > > Yes, when you don't give an initializer, it is still initialized.
                  > > "Initialize r" and "Initialization " are different things. Even if you
                  > > don't use an initializer, initialization still takes place.[/color]
                  >
                  > Initialization is the action. An action of giving a determined value to
                  > some object. If this is not done, well, then it is not initialized.[/color]

                  Now this raises a new issue. Does the compiler keep track of whether or not
                  a variable that it has allocated has yet had a value assigned to it? In
                  Java, for example, they do. Does C++?

                  I have operated on the assumption that when a variable is displayed, the
                  complier does not know at that point in code whether or not the area of the
                  variable has been stored into. To do that it would either 1) have some sort
                  of table of variables which has flags indicating whether or not the variable
                  had been assigned, or 2) have a set of bits in that variable that indicated
                  "this variable is empty." But I believe (see other posts) that any bit
                  combination in a variable can be interpreted as a value of the type of that
                  variable. Perhaps THIS is wrong.

                  Can, for example, a 4-byte int contain 1 bits in the high order half? Or
                  will the compiler simply ignore them since only the low order half can
                  contain the range of an int? I have always expected the compiler to ignore
                  the high order half. (For all I know the middle two bytes of a 4-byte int
                  contain the value of the int!)
                  --
                  Gary


                  Comment

                  • Attila Feher

                    #84
                    Re: class object initialisation

                    Gary Labowitz wrote:
                    [SNIP][color=blue]
                    > This looks like fun, so I'll take my stab at it.[/color]

                    :-) We have way too much time on our hands. ;-)
                    [color=blue]
                    > When a variable is made available to a program,
                    > the compiler must have generated code that sets
                    > aside some area of memory for use by the
                    > program.[/color]

                    OK. Let's change memory to something what can be written in the standard...
                    let's call it storage.

                    Now we have to obfuscate your sentence, since if just anybody could
                    understand it (langauge) lawyers (like us ;-) ) would be out of business.
                    Variable is for example a very bad name, because programmers actually
                    understand what it means. Also it is not appropriate here: the process we
                    are going to describe is also applicable to unnamed temporaries, and those
                    are not variables.

                    In C++ the creation of an object is done in two steps, one of which is
                    optional for objects of POD types. In the first step appropriate (size,
                    alignment) storage is assigned to the object.
                    [color=blue]
                    > If the generated code of the compiler also puts a
                    > predetermined value in the area of memory, this is called
                    > initialization.[/color]

                    The second, optional for POD types, step is initialization.
                    [color=blue]
                    > I.e. the memory allocated to the variable, if
                    > examined with (say) a cout << operation, will show a value that the
                    > programmer specified in the declaration that requested the
                    > allocation. However, if the programmer did not specify an initial
                    > value in the declaration, all bets are off. The initial value of the
                    > variable could be anything and is usually whatever was in the memory
                    > area prior to its being used as the variable being declared.[/color]

                    Without initialization it is not guaranteed that the object represents a
                    valid value for its own type, therefore it is results in undefined behavior
                    (behaviour for Europeans) if the object is used as an rvalue.

                    Initialization might happen different ways. Initialization can take the
                    form of explicit initializer or implicit initialization.
                    [color=blue]
                    > For certain structures, the compiler will zero-initialize members
                    > implicitly, without the programmer having to specifically declare an
                    > initial value.[/color]

                    (list cases of implicit initialization)
                    [color=blue]
                    > In the case of arrays, for example, if fewer initial
                    > values are provided than the array can store, zero-initialiation will
                    > be done for the remaining array elements.
                    >
                    > Once the variable is available to the program, any movement of a
                    > different value into the variable, such as with an assignment
                    > operation, is called assignment.[/color]

                    Storage belonging to objects of POD types might stay in an uninitialized
                    from until an initial rvalue of a correct type has been assigned to it.
                    [
                    int i; // Storage assigned, uninitialized
                    int j=i; // Undefined behavior, i is not initialized
                    i = 12; // After the ; i is initialized to 12 using assignment
                    ]
                    [color=blue]
                    > The entire issue is: What is in the variable immediately
                    > after its "creation?"[/color]

                    An uninitialized object, just like with classes. When the operator new
                    returns it points to a well aligned and big enough storage area, but this
                    storage area does not yet the conform to the requirements of its final type.
                    [color=blue]
                    > If it is a determinate value, specified by the
                    > programmer, it has been "initialize d" by the compiler.[/color]

                    And for PODs this initialization is done by the compiler in the form of
                    "first assignment". :-)
                    [color=blue]
                    > [Note: by "memory area" I do not exclude use of registers, data
                    > bases, or any other mechanism any given compiler chooses to use for
                    > variable storage.][/color]

                    It is called storage in the standard (for that very reason, that it might
                    not be RAM, which we usually think about when we say memory).
                    [color=blue]
                    > Does this make sense to anyone?[/color]

                    Sort of. :-)

                    --
                    Attila aka WW


                    Comment

                    • Attila Feher

                      #85
                      Re: class object initialisation

                      Gary Labowitz wrote:[color=blue]
                      > "White Wolf" <wolof@freemail .hu> wrote in message
                      > news:bk67pi$kmt $1@phys-news1.kolumbus. fi...
                      > <<snip>>[color=green]
                      >> int i =1; does exaclty the same as
                      >> int i;
                      >> i=1;[/color]
                      >
                      > Now this may be the crux of the issue. Is
                      > int i = 1;
                      > the same as
                      > int i;
                      > i=1;
                      > ?????[/color]

                      Not by the current wording of the standard:

                      int i = 1; // i is created and initialized to a determined value

                      // assuming i is automatic
                      int i; // i is created and initialized to an indeterminate value
                      // IMHO this should be not-initialized
                      i=1; // i is assinged a determinate value

                      IMHO if there is nothing between the two lines above it is tha same thing.
                      [color=blue]
                      > I'm on unfirm ground here, but in my youth
                      > I knew of compilers that treated int i = 1;
                      > as a statement leading to compiling the area
                      > to be used by the program into the executable
                      > with the value of the area already set to 1.[/color]

                      Not for automatic objects, which are at hearth of this discussion. The
                      "stack" does not exist compile time. It will become an assignment runtime.
                      [color=blue]
                      > This meant that when the program was loaded, so was
                      > the area for i, already initialized to 1.[/color]

                      If i is global, yes.
                      [color=blue]
                      > There was no code run to "initialize " the area;
                      > it started life with the bits already set for
                      > that type's 1.[/color]

                      Can onyl happen if i can be assigned storage during compilation. That is
                      not the case with automatic (stack) variables.
                      [color=blue]
                      > Does this happen at all with current C++ compilers? Say, with
                      > globals? Or constants? (I really don't know, just asking.)[/color]

                      With globals it does. With (integral) constants: they usuallay have no
                      storage in C++.

                      --
                      Attila aka WW


                      Comment

                      • Attila Feher

                        #86
                        Re: class object initialisation

                        Gary Labowitz wrote:[color=blue]
                        > "Attila Feher" <attila.feher@l mf.ericsson.se> wrote in message
                        > news:bk6m18$8g1 $1@newstree.wis e.edt.ericsson. se...
                        >[color=green]
                        >> Yes. "Indetermin ate value" implies: it is an int, but with some
                        >> garbage value in it; while the truth is: it is a place for an int,
                        >> with no int in it.[/color]
                        >
                        > Still disagree. An int with some bits in it that I didn't know would
                        > be there ("indetermin ate value") is still an int value.[/color]

                        Really? How about a computer with a 60 bits int, which stores it in a 64
                        bits storage area with 4 bits of CRC?
                        [color=blue]
                        > Display it and you will see what value of int it is[/color]

                        Nope. Using that int as an rvalue is undefined behavior. Using the
                        Deathstation 9000 computer displaying such an int value will cause your
                        house to burn down or your mother-in-law moving in permanently with you -
                        depending on the operating system version.
                        [color=blue]
                        > -- and not to your liking, perhaps, but still an int.[/color]

                        That is the whole idea: it is *not* necessarily an int!
                        [color=blue]
                        > [Translation: all bit combinations in an
                        > area declared as an int ARE int's.][/color]

                        It is *not* required by the standard.
                        [color=blue]
                        > This is because the compiler
                        > generates code that picks up the number of bytes it uses for an int
                        > and interprets the bits in there as the value. Just because you don't
                        > know what is in that area doesn't make it not an int value.[/color]

                        Wrong.

                        --
                        Attila aka WW


                        Comment

                        • Attila Feher

                          #87
                          Re: class object initialisation

                          Gary Labowitz wrote:[color=blue]
                          > "White Wolf" <wolof@freemail .hu> wrote in message
                          > news:bk56j0$4c3 $1@phys-news1.kolumbus. fi...[color=green]
                          >> Nope. An initialized object of any kind *might* contain an
                          >> indeterminate value (like initialized by rand()) but it contains a
                          >> value which is in the value set of the type for that object (object
                          >> in C sense). Uninitialized (auto) PODs do not fullfill this
                          >> requirement. If something is not initialized and it might not even
                          >> be of its own type is uninitialized.[/color]
                          >
                          > Disagree. The type of a variable specifies two things: the size of
                          > memory to be accessed and the encoding of the bits in that area.[/color]

                          Yes.
                          [color=blue]
                          > As far as I know, there are not "invalid" combinations of bits for
                          > a type.[/color]

                          Wrong. There is nothing in the C++ standard which requires this. A
                          platform is free to represent an integer on 128 bits with 64 bits for value
                          and 64 bits for checksum.
                          [color=blue]
                          > Whatever is in there is interpreted according to the encoding
                          > of the type.[/color]

                          It does not necessarily have a meaning. ints aside, this is especially true
                          with pointers. An implementation is free to encode the pointed type into
                          the pointer's bit value.
                          [color=blue]
                          > The value this results in is usually garbage, but is
                          > still a value of the type.[/color]

                          Wrong.
                          [color=blue]
                          > Having said that, I wonder if bool types MUST be either all ones or
                          > all zeros.[/color]

                          Do not wonder. Read the standard. It does not. And indeterminate value
                          for a bool does not need to represent either true or false. It is in there.
                          [color=blue]
                          > Would a bool containing mixed bits confuse a formatter
                          > (like cout) or would it just say "Hmmm, not all zeros --- therefore,
                          > true!"[/color]

                          Implementation defined.

                          --
                          Attila aka WW


                          Comment

                          • Attila Feher

                            #88
                            Re: class object initialisation

                            Gary Labowitz wrote:[color=blue]
                            > "White Wolf" <wolof@freemail .hu> wrote in message
                            > news:bk4fn3$s9s $1@phys-news1.kolumbus. fi...[color=green]
                            >> tom_usenet wrote:
                            >> [SNIP][color=darkred]
                            >>> Yes, when you don't give an initializer, it is still initialized.
                            >>> "Initialize r" and "Initialization " are different things. Even if you
                            >>> don't use an initializer, initialization still takes place.[/color]
                            >>
                            >> Initialization is the action. An action of giving a determined
                            >> value to some object. If this is not done, well, then it is not
                            >> initialized.[/color]
                            >
                            > Now this raises a new issue. Does the compiler keep track of whether
                            > or not a variable that it has allocated has yet had a value assigned
                            > to it? In Java, for example, they do. Does C++?[/color]

                            Nope. In the name of efficiency (the route of all evil) it does not.
                            [color=blue]
                            > I have operated on the assumption that when a variable is displayed,
                            > the complier does not know at that point in code whether or not the
                            > area of the variable has been stored into.[/color]

                            It does not, only for statics in a function. Valgrind might tell you, but
                            only if you try to make a decision using that value.
                            [color=blue]
                            > To do that it would either
                            > 1) have some sort of table of variables which has flags indicating
                            > whether or not the variable had been assigned, or 2) have a set of
                            > bits in that variable that indicated "this variable is empty." But I
                            > believe (see other posts) that any bit combination in a variable can
                            > be interpreted as a value of the type of that variable. Perhaps THIS
                            > is wrong.[/color]

                            It is. It is true on many architectures but it is not a rule, it just
                            happens to be that way.
                            [color=blue]
                            > Can, for example, a 4-byte int contain 1 bits in the high order half?
                            > Or will the compiler simply ignore them since only the low order half
                            > can contain the range of an int? I have always expected the compiler
                            > to ignore the high order half. (For all I know the middle two bytes
                            > of a 4-byte int contain the value of the int!)[/color]

                            That is complete bull-byproduct.

                            --
                            Attila aka WW


                            Comment

                            • White Wolf

                              #89
                              Re: class object initialisation

                              Kevin Goodsell wrote:
                              [SNIP][color=blue][color=green]
                              >> Then the wording of the standard (in those cases) is weak. I mean
                              >> C++ is complicated enough without making its standard hard to
                              >> understand.
                              >>[/color]
                              >
                              > I agree. But it happens.[/color]

                              It? Or
                              #!sh
                              it
                              ?
                              ;-)

                              --
                              WW aka Attila


                              Comment

                              • tom_usenet

                                #90
                                Re: class object initialisation

                                On Tue, 16 Sep 2003 12:44:43 +0300, "Attila Feher"
                                <attila.feher@l mf.ericsson.se> wrote:
                                [color=blue]
                                >tom_usenet wrote:[color=green][color=darkred]
                                >>> Nope. An initialized object of any kind *might* contain an
                                >>> indeterminate value (like initialized by rand()) but it contains a
                                >>> value which is in the value set of the type for that object (object
                                >>> in C sense). Uninitialized (auto) PODs do not fullfill this
                                >>> requirement. If something is not initialized and it might not even
                                >>> be of its own type is uninitialized.[/color]
                                >>
                                >> Being initialized by rand doesn't make something indeterminate, since
                                >> you can examine its value and hence find out what it is. Indeterminate
                                >> means that you cannot determine the value, not that you don't know the
                                >> value.[/color]
                                >
                                >Well, in my poor English vocabulary that is non-determinable. Indeterminate
                                >is (for me) something we do not know for sure (like what will rand put
                                >there) but we can find out later. Non-determinable is OTOH something which
                                >cannot be examined.[/color]

                                Indeterminate:
                                a)Not precisely determined, determinable, or established: a person of
                                indeterminate age.
                                b)Not precisely fixed, as to extent, size, nature, or number: an
                                indeterminate number of plant species in the jungle.
                                c)Lacking clarity or precision, as in meaning; vague: an indeterminate
                                turn of phrase.
                                d)Not fixed or known in advance: an indeterminate future.
                                e)Not leading up to a definite result or ending: an indeterminate
                                campaign.

                                So indeterminate can mean either not precisely determined or not
                                determinable. The standard clearly uses it to mean not determinable
                                (since you aren't allowed to examine the value).
                                [color=blue][color=green]
                                >> There are even more catches to this.
                                >>
                                >> unsigned char c;
                                >> c = c; //legal!
                                >>
                                >> unsigned char can never have indeterminate values (because all bits of
                                >> the object representation take part in the value representation) .[/color]
                                >
                                >Where is that required by the standard?[/color]

                                3.9.1/1
                                Also:

                                [color=blue][color=green]
                                >> This is
                                >> useful elsewhere though: invalid pointers do have indeterminate
                                >> values, according to the note in 5.3.5/4.[/color]
                                >
                                >Again a bit of a mystery. delete take a *copy* of the pointer. So it
                                >cannot change it at all. So the value of the pointer *is* determined, we
                                >exactly know what value it has. Only this value is not to be dereferenced.[/color]

                                It is indeterminate since, although the bit pattern won't have
                                changed, valid bit patterns for pointers might have been changed by
                                the delete.

                                Tom

                                Comment

                                Working...