PROVEN WRONG!

Discussion in 'C++' started by Paul, Mar 18, 2011.

  1. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 17/03/2011 23:00, Paul wrote:
    >>

    <prune>
    >>>>>
    >>>>> Maybe the following will help you understand the semantic differences
    >>>>> involved:
    >>>>>
    >>>>> int main()
    >>>>> {
    >>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element of an
    >>>>> array
    >>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    >>>>> }
    >>>>>
    >>>> This is a clear indication of how screwed up you are. Please read the
    >>>> following :
    >>>>
    >>>> "the newexpression yields a pointer to the initial element (if any)
    >>>> of the
    >>>> array. [Note: both new int and new int[10] have type int* and the type
    >>>> of new int[10] is
    >>>> int (*)[10]. ]"
    >>>>
    >>>>
    >>>> The standards define both of these types to be pointers to the array,
    >>>> they are just different *types* of pointer.
    >>>>
    >>>
    >>> No; for the final time: int* is not a pointer to an array; int* is a
    >>> pointer to a scalar; the Standard clearly states "the new-expression
    >>> yields a pointer to the initial element (if any) of the array"; it
    >>> doesn't state that "the new-expression yields a pointer to the array".
    >>>

    >>
    >> Err no your nonsense is becoming beyond belief .
    >> A pointer to the first element *IS* a pointer to the array.
    >>
    >> The standards states clearly that both int* and int(*)[10] are pointers
    >> to the first element. There is no difference in what these pointers
    >> point to. You must think int(*)[10] is an array of pointers or something
    >> , *shakes head* no I don't know what nonsense you think.
    >>

    >
    > Yes everything seems like nonsense to you as you are either unable or
    > unwilling to be get a firm technical grasp on C++ matters.
    >

    PROVEN WRONG!
     
    Paul, Mar 18, 2011
    #1
    1. Advertising

  2. Paul

    Paul Guest

    And the idiot is now arguing about what he is wrong about :-S Duh,
     
    Paul, Mar 18, 2011
    #2
    1. Advertising

  3. Paul

    puppi Guest

    On Mar 17, 9:48 pm, "Paul" <> wrote:
    > "Leigh Johnston" <> wrote in message
    >
    > news:...
    >
    > > On 17/03/2011 23:00, Paul wrote:

    >
    > <prune>
    >
    > >>>>> Maybe the following will help you understand the semantic differences
    > >>>>> involved:

    >
    > >>>>> int main()
    > >>>>> {
    > >>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element of an
    > >>>>> array
    > >>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    > >>>>> }

    >
    > >>>> This is a clear indication of how screwed up you are. Please read the
    > >>>> following :

    >
    > >>>> "the newexpression yields a pointer to the initial element (if any)
    > >>>> of the
    > >>>> array. [Note: both new int and new int[10] have type int* and the type
    > >>>> of new int[10] is
    > >>>> int (*)[10]. ]"

    >
    > >>>> The standards define both of these types to be pointers to the array,
    > >>>> they are just different *types* of pointer.

    >
    > >>> No; for the final time: int* is not a pointer to an array; int* is a
    > >>> pointer to a scalar; the Standard clearly states "the new-expression
    > >>> yields a pointer to the initial element (if any) of the array"; it
    > >>> doesn't state that "the new-expression yields a pointer to the array"..

    >
    > >> Err no your nonsense is becoming beyond belief .
    > >> A pointer to the first element *IS* a pointer to the array.

    >
    > >> The standards states clearly that both int* and int(*)[10] are pointers
    > >> to the first element. There is no difference in what these pointers
    > >> point to. You must think int(*)[10] is an array of pointers or something
    > >> , *shakes head* no I don't know what nonsense you think.

    >
    > > Yes everything seems like nonsense to you as you are either unable or
    > > unwilling to be get a firm technical grasp on C++ matters.

    >
    > PROVEN WRONG!


    The only true difference between "int* p1 = new int[42]" and "int (*p2)
    [42] = new int[1][42]" is how offsets are computed. ANSI C (and
    Standard C++) implement multidimensional arrays as dope vectors, i.e.
    as a long linear array with a polynomial evaluation of offsets, which
    causes it to act as a multidimensional array. A call such as "new
    int[2][42]" would truly return the address of the first element of a
    2*42=84 int elements array. They are the same thing at the machine
    level. They differ only in how the compiler computes offsets. If n is
    an integer type, an expression such as "p1+n" evaluates as the address
    in p1 plus n*sizeof(int), while an expression such as "p2+n" evaluates
    as the address in p2 plus n*sizeof(int[42]) == 42*n*sizeof(int). An
    expression such as "p2[n][m]" evaluates as the address in p2 plus
    42*n*sizeof(int)+m*sizeof(int). The following code illustrates that,
    where I changed the definition of p2 to "new int[2][42]" for further
    explanations:

    #include <cstddef>
    #include <cassert>

    int main()
    {
    volatile int *p1 = new int[42];
    volatile int (*p2)[42] = new int[2][42];

    //follow the generated assembly code from here...
    asm volatile
    (
    "nop;\nnop;"
    );

    p1[2];

    asm volatile
    (
    "nop;\nnop;"
    );

    p2[0][-1];

    asm volatile
    (
    "nop;\nnop;"
    );
    //...to here

    assert(&p2[1][-1] == &(*p2)[41]);

    asm volatile
    (
    "nop;\nnop;"
    );

    volatile int *p3 = (int*)p2;

    assert(p3+42 == (int*)(p2+1));

    for(size_t i = 0; i < 42; i++)
    assert(&p3 == &p2[0]);

    for(size_t i = 0; i < 42; i++)
    assert(&p3[42+i] == &p2[1]);

    asm volatile
    (
    "nop;\nnop;"
    );

    return 0;
    }

    If you know your assembly, you should follow how access is made for p1
    and p2. You will see it's identical. In my pc generated the following
    code fragment for the first part (where p1 was stored in rbp-0x8 and
    p2 in rbp-0x10):
    movq -8(%rbp), %rax
    addq $8, %rax
    movl (%rax), %eax

    nop;
    nop;

    movq -16(%rbp), %rax
    movl -4(%rax), %eax
    It's simply the same. I declared the pointers volatile simply to
    prevent the compiler from "weeding out" parts of my code with no
    possible side-effects. Only the line "&p2[1][-1] == &(*p2)[41]" may
    not work under all compilers. It will work if and only if
    sizeof(size_t)==sizeof(void*).
     
    puppi, Mar 18, 2011
    #3
  4. Paul

    Paul Guest

    "puppi" <> wrote in message
    news:...
    On Mar 17, 9:48 pm, "Paul" <> wrote:
    > "Leigh Johnston" <> wrote in message
    >
    > news:...
    >
    > > On 17/03/2011 23:00, Paul wrote:

    >
    > <prune>
    >
    > >>>>> Maybe the following will help you understand the semantic
    > >>>>> differences
    > >>>>> involved:

    >
    > >>>>> int main()
    > >>>>> {
    > >>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element of
    > >>>>> an
    > >>>>> array
    > >>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    > >>>>> }

    >
    > >>>> This is a clear indication of how screwed up you are. Please read the
    > >>>> following :

    >
    > >>>> "the newexpression yields a pointer to the initial element (if any)
    > >>>> of the
    > >>>> array. [Note: both new int and new int[10] have type int* and the
    > >>>> type
    > >>>> of new int[10] is
    > >>>> int (*)[10]. ]"

    >
    > >>>> The standards define both of these types to be pointers to the array,
    > >>>> they are just different *types* of pointer.

    >
    > >>> No; for the final time: int* is not a pointer to an array; int* is a
    > >>> pointer to a scalar; the Standard clearly states "the new-expression
    > >>> yields a pointer to the initial element (if any) of the array"; it
    > >>> doesn't state that "the new-expression yields a pointer to the array".

    >
    > >> Err no your nonsense is becoming beyond belief .
    > >> A pointer to the first element *IS* a pointer to the array.

    >
    > >> The standards states clearly that both int* and int(*)[10] are pointers
    > >> to the first element. There is no difference in what these pointers
    > >> point to. You must think int(*)[10] is an array of pointers or
    > >> something
    > >> , *shakes head* no I don't know what nonsense you think.

    >
    > > Yes everything seems like nonsense to you as you are either unable or
    > > unwilling to be get a firm technical grasp on C++ matters.

    >
    > PROVEN WRONG!


    The only true difference between "int* p1 = new int[42]" and "int (*p2)
    [42] = new int[1][42]" is how offsets are computed. ANSI C (and
    Standard C++) implement multidimensional arrays as dope vectors, i.e.
    as a long linear array with a polynomial evaluation of offsets, which
    causes it to act as a multidimensional array. A call such as "new
    int[2][42]" would truly return the address of the first element of a
    2*42=84 int elements array. They are the same thing at the machine
    level. They differ only in how the compiler computes offsets. If n is
    an integer type, an expression such as "p1+n" evaluates as the address
    in p1 plus n*sizeof(int), while an expression such as "p2+n" evaluates
    as the address in p2 plus n*sizeof(int[42]) == 42*n*sizeof(int). An
    expression such as "p2[n][m]" evaluates as the address in p2 plus
    42*n*sizeof(int)+m*sizeof(int). The following code illustrates that,
    where I changed the definition of p2 to "new int[2][42]" for further
    explanations:
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Exactly, the only difference is how the compiler computes the offsets.
    And, BTW, nobody in their right mind is ever going to use a type such as
    int(*)[64] anyway.

    Sorry my auto indentation is not working for this message.

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


    #include <cstddef>
    #include <cassert>

    int main()
    {
    volatile int *p1 = new int[42];
    volatile int (*p2)[42] = new int[2][42];

    //follow the generated assembly code from here...
    asm volatile
    (
    "nop;\nnop;"
    );

    p1[2];

    asm volatile
    (
    "nop;\nnop;"
    );

    p2[0][-1];

    asm volatile
    (
    "nop;\nnop;"
    );
    //...to here

    assert(&p2[1][-1] == &(*p2)[41]);

    asm volatile
    (
    "nop;\nnop;"
    );

    volatile int *p3 = (int*)p2;

    assert(p3+42 == (int*)(p2+1));

    for(size_t i = 0; i < 42; i++)
    assert(&p3 == &p2[0]);

    for(size_t i = 0; i < 42; i++)
    assert(&p3[42+i] == &p2[1]);

    asm volatile
    (
    "nop;\nnop;"
    );

    return 0;
    }

    If you know your assembly, you should follow how access is made for p1
    and p2. You will see it's identical. In my pc generated the following
    code fragment for the first part (where p1 was stored in rbp-0x8 and
    p2 in rbp-0x10):
    movq -8(%rbp), %rax
    addq $8, %rax
    movl (%rax), %eax

    nop;
    nop;

    movq -16(%rbp), %rax
    movl -4(%rax), %eax
    It's simply the same. I declared the pointers volatile simply to
    prevent the compiler from "weeding out" parts of my code with no
    possible side-effects. Only the line "&p2[1][-1] == &(*p2)[41]" may
    not work under all compilers. It will work if and only if
    sizeof(size_t)==sizeof(void*).

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Yes the pointer-type does not affect what it points to in this case. The
    only difference is pointer arithmetic in the case of..
    int p(*)[size]
    1 = sizeof(int) * size.

    Not too difficult to understand is it . :)
     
    Paul, Mar 18, 2011
    #4
  5. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 18/03/2011 10:49, puppi wrote:
    >>
    >> The only true difference between "int* p1 = new int[42]" and "int (*p2)
    >> [42] = new int[1][42]" is how offsets are computed. ANSI C (and

    > [...]
    >
    > As far as the *language* is concerned 'p1' is a pointer to a scalar and
    > 'p2' is a pointer to an array; what machine code is actually emitted by a
    > particular implementation when using these pointers is irrelevant.
    >

    Your wording is very err wrong.

    p1 is pointer to int *type*.

    p2 is pointer to array *type*


    Both pointers point to arrays, the difference is dereferenced p1 yields the
    an int .

    dereferenced p2 yields a pointer to the next dimension of the array. That is
    p2 is the same as a pointer to a pointer type.
    int* dim2 = p2[2];
    std::cout<< dim2[2];

    is the same as
    std::cout<< p2[2][2];

    Its identical to int**.


    As far as the language is concerned p1 points to the intial element *of an
    array*. The "machine code" isn't irrellevant if it provides a better
    understanding of things work.

    Note: asm is not machine code. :-S
     
    Paul, Mar 18, 2011
    #5
  6. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 18/03/2011 13:19, Paul wrote:
    >>
    >> "Leigh Johnston" <> wrote in message
    >> news:...
    >>> On 18/03/2011 10:49, puppi wrote:
    >>>>
    >>>> The only true difference between "int* p1 = new int[42]" and "int (*p2)
    >>>> [42] = new int[1][42]" is how offsets are computed. ANSI C (and
    >>> [...]
    >>>
    >>> As far as the *language* is concerned 'p1' is a pointer to a scalar
    >>> and 'p2' is a pointer to an array; what machine code is actually
    >>> emitted by a particular implementation when using these pointers is
    >>> irrelevant.
    >>>

    >> Your wording is very err wrong.
    >>
    >> p1 is pointer to int *type*.

    >
    > "int type" is a scalar so my wording is not wrong.



    LOL NO its a scalar *TYPE*. Are you a tiotal fucking idiot altogehter?

    >
    >>
    >> p2 is pointer to array *type*

    >

    FFS sniop plonk
    Idiot.
     
    Paul, Mar 18, 2011
    #6
  7. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 18/03/2011 13:53, Paul wrote:
    >>
    >> "Leigh Johnston" <> wrote in message
    >> news:...
    >>> On 18/03/2011 13:19, Paul wrote:
    >>>>
    >>>> "Leigh Johnston" <> wrote in message
    >>>> news:...
    >>>>> On 18/03/2011 10:49, puppi wrote:
    >>>>>>
    >>>>>> The only true difference between "int* p1 = new int[42]" and "int
    >>>>>> (*p2)
    >>>>>> [42] = new int[1][42]" is how offsets are computed. ANSI C (and
    >>>>> [...]
    >>>>>
    >>>>> As far as the *language* is concerned 'p1' is a pointer to a scalar
    >>>>> and 'p2' is a pointer to an array; what machine code is actually
    >>>>> emitted by a particular implementation when using these pointers is
    >>>>> irrelevant.
    >>>>>
    >>>> Your wording is very err wrong.
    >>>>
    >>>> p1 is pointer to int *type*.
    >>>
    >>> "int type" is a scalar so my wording is not wrong.

    >>
    >>
    >> LOL NO its a scalar *TYPE*. Are you a tiotal fucking idiot altogehter?

    >
    > You are the idiot. Saying "an int type is a scalar" is similar to saying
    > "an int type is an int"; both are correct.
    >
    >>
    >>>
    >>>>
    >>>> p2 is pointer to array *type*
    >>>

    >> FFS sniop plonk
    >> Idiot.

    >
    > As you show absolutely no willingness to be educated I would be *very*
    > happy if you actually meant that plonk.
    >


    At least I can be educated, you're just presenting totally nonsensical
    idioticness all the time.
     
    Paul, Mar 18, 2011
    #7
  8. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 18/03/2011 16:16, Paul wrote:
    >>
    >> "Leigh Johnston" <> wrote in message
    >> news:...
    >>> On 18/03/2011 13:53, Paul wrote:
    >>>>


    <snip>
    > I hope you are a troll; I really do; if you aren't a troll and you
    > genuinely believe the garbage you post then your situation is probably
    > hopeless.
    >
    > /Leigh
    >


    Leigh you have nothing sensible to say because I have once again PROVEN YOU
    WRONG.
    Now why don't you shut up and quietly go away and accept that instead of
    behaving like a 6 year old child who had their sweeties taken .
     
    Paul, Mar 18, 2011
    #8
  9. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 18/03/2011 16:44, Paul wrote:
    >>
    >> "Leigh Johnston" <> wrote in message
    >> news:...
    >>> On 18/03/2011 16:16, Paul wrote:
    >>>>
    >>>> "Leigh Johnston" <> wrote in message
    >>>> news:...
    >>>>> On 18/03/2011 13:53, Paul wrote:
    >>>>>>

    >>
    >> <snip>
    >>> I hope you are a troll; I really do; if you aren't a troll and you
    >>> genuinely believe the garbage you post then your situation is probably
    >>> hopeless.
    >>>
    >>> /Leigh
    >>>

    >>
    >> Leigh you have nothing sensible to say because I have once again PROVEN
    >> YOU WRONG.
    >> Now why don't you shut up and quietly go away and accept that instead of
    >> behaving like a 6 year old child who had their sweeties taken .
    >>

    >
    > The way you repeatedly describe yourself when trying to insult others is
    > quite uncanny.
    >
    >>>>> Maybe the following will help you understand the semantic differences
    >>>>> involved:
    >>>>>
    >>>>> int main()
    >>>>> {
    >>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element of an
    >>>>> array
    >>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    >>>>> }
    >>>>>
    >>>> This is a clear indication of how screwed up you are. Please read the
    >>>> following :
    >>>>
    >>>> "the newexpression yields a pointer to the initial element (if any)
    >>>> of the
    >>>> array. [Note: both new int and new int[10] have type int* and the type
    >>>> of new int[10] is
    >>>> int (*)[10]. ]"
    >>>>
    >>>>
    >>>> The standards define both of these types to be pointers to the array,
    >>>> they are just different *types* of pointer.
    >>>>

    PROVEN WRONG !!
    I have nothing more to say , shut up and go away child.
     
    Paul, Mar 18, 2011
    #9
  10. Paul

    Noah Roberts Guest

    On 3/18/2011 3:49 AM, puppi wrote:
    > On Mar 17, 9:48 pm, "Paul"<> wrote:


    Holy fucking christ! Just because this asshole makes yet another new
    thread to piss about the same stupid thing doesn't mean people need to
    reply.

    Is this newsgroup totally dead now? After clearing out the "OMG I got
    to prove Paul wrong" bullshit there was only like 3-4 messages of any
    interest left.

    --
    http://crazycpp.wordpress.com
     
    Noah Roberts, Mar 18, 2011
    #10
  11. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 18/03/2011 17:06, Paul wrote:
    >>
    >> "Leigh Johnston" <> wrote in message
    >> news:...
    >>> On 18/03/2011 16:44, Paul wrote:
    >>>>
    >>>> "Leigh Johnston" <> wrote in message
    >>>> news:...
    >>>>> On 18/03/2011 16:16, Paul wrote:
    >>>>>>
    >>>>>> "Leigh Johnston" <> wrote in message
    >>>>>> news:...
    >>>>>>> On 18/03/2011 13:53, Paul wrote:
    >>>>>>>>
    >>>>
    >>>> <snip>
    >>>>> I hope you are a troll; I really do; if you aren't a troll and you
    >>>>> genuinely believe the garbage you post then your situation is probably
    >>>>> hopeless.
    >>>>>
    >>>>> /Leigh
    >>>>>
    >>>>
    >>>> Leigh you have nothing sensible to say because I have once again PROVEN
    >>>> YOU WRONG.
    >>>> Now why don't you shut up and quietly go away and accept that instead
    >>>> of
    >>>> behaving like a 6 year old child who had their sweeties taken .
    >>>>
    >>>
    >>> The way you repeatedly describe yourself when trying to insult others
    >>> is quite uncanny.
    >>>
    >>>>>>> Maybe the following will help you understand the semantic
    >>>>>>> differences
    >>>>>>> involved:
    >>>>>>>
    >>>>>>> int main()
    >>>>>>> {
    >>>>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element
    >>>>>>> of an
    >>>>>>> array
    >>>>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    >>>>>>> }
    >>>>>>>
    >>>>>> This is a clear indication of how screwed up you are. Please read the
    >>>>>> following :
    >>>>>>
    >>>>>> "the newexpression yields a pointer to the initial element (if any)
    >>>>>> of the
    >>>>>> array. [Note: both new int and new int[10] have type int* and the
    >>>>>> type
    >>>>>> of new int[10] is
    >>>>>> int (*)[10]. ]"
    >>>>>>
    >>>>>>
    >>>>>> The standards define both of these types to be pointers to the array,
    >>>>>> they are just different *types* of pointer.
    >>>>>>

    >> PROVEN WRONG !!

    >
    > What have I been proven wrong about exactly? Where is this proof? BTW
    > "pointer to the initial element of an array" is not the same as "pointer
    > to an array".
    >
    >> I have nothing more to say , shut up and go away child.

    >
    > Look in the mirror if you want to see something childish.
    >
    >>>>> Maybe the following will help you understand the semantic differences
    >>>>> involved:
    >>>>>
    >>>>> int main()
    >>>>> {
    >>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element of an
    >>>>> array
    >>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    >>>>> }
    >>>>>
    >>>> This is a clear indication of how screwed up you are. Please read the
    >>>> following :
    >>>>
    >>>> "the newexpression yields a pointer to the initial element (if any)
    >>>> of the
    >>>> array. [Note: both new int and new int[10] have type int* and the type
    >>>> of new int[10] is
    >>>> int (*)[10]. ]"
    >>>>
    >>>>
    >>>> The standards define both of these types to be pointers to the array,
    >>>> they are just different *types* of pointer.
    >>>>

    PROVEN WRONG !!
    I have nothing more to say .
     
    Paul, Mar 18, 2011
    #11
  12. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 18/03/2011 17:40, Paul wrote:
    >>
    >> "Leigh Johnston" <> wrote in message
    >> news:...
    >>> On 18/03/2011 17:06, Paul wrote:
    >>>>
    >>>> "Leigh Johnston" <> wrote in message
    >>>> news:...
    >>>>> On 18/03/2011 16:44, Paul wrote:
    >>>>>>
    >>>>>> "Leigh Johnston" <> wrote in message
    >>>>>> news:...
    >>>>>>> On 18/03/2011 16:16, Paul wrote:
    >>>>>>>>
    >>>>>>>> "Leigh Johnston" <> wrote in message
    >>>>>>>> news:...
    >>>>>>>>> On 18/03/2011 13:53, Paul wrote:
    >>>>>>>>>>
    >>>>>>
    >>>>>> <snip>
    >>>>>>> I hope you are a troll; I really do; if you aren't a troll and you
    >>>>>>> genuinely believe the garbage you post then your situation is
    >>>>>>> probably
    >>>>>>> hopeless.
    >>>>>>>
    >>>>>>> /Leigh
    >>>>>>>
    >>>>>>
    >>>>>> Leigh you have nothing sensible to say because I have once again
    >>>>>> PROVEN
    >>>>>> YOU WRONG.
    >>>>>> Now why don't you shut up and quietly go away and accept that
    >>>>>> instead of
    >>>>>> behaving like a 6 year old child who had their sweeties taken .
    >>>>>>
    >>>>>
    >>>>> The way you repeatedly describe yourself when trying to insult others
    >>>>> is quite uncanny.
    >>>>>
    >>>>>>>>> Maybe the following will help you understand the semantic
    >>>>>>>>> differences
    >>>>>>>>> involved:
    >>>>>>>>>
    >>>>>>>>> int main()
    >>>>>>>>> {
    >>>>>>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element
    >>>>>>>>> of an
    >>>>>>>>> array
    >>>>>>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    >>>>>>>>> }
    >>>>>>>>>
    >>>>>>>> This is a clear indication of how screwed up you are. Please read
    >>>>>>>> the
    >>>>>>>> following :
    >>>>>>>>
    >>>>>>>> "the newexpression yields a pointer to the initial element (if any)
    >>>>>>>> of the
    >>>>>>>> array. [Note: both new int and new int[10] have type int* and the
    >>>>>>>> type
    >>>>>>>> of new int[10] is
    >>>>>>>> int (*)[10]. ]"
    >>>>>>>>
    >>>>>>>>
    >>>>>>>> The standards define both of these types to be pointers to the
    >>>>>>>> array,
    >>>>>>>> they are just different *types* of pointer.
    >>>>>>>>
    >>>> PROVEN WRONG !!
    >>>
    >>> What have I been proven wrong about exactly? Where is this proof? BTW
    >>> "pointer to the initial element of an array" is not the same as
    >>> "pointer to an array".
    >>>
    >>>> I have nothing more to say , shut up and go away child.
    >>>
    >>> Look in the mirror if you want to see something childish.
    >>>
    >>>>>>> Maybe the following will help you understand the semantic
    >>>>>>> differences
    >>>>>>> involved:
    >>>>>>>
    >>>>>>> int main()
    >>>>>>> {
    >>>>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element
    >>>>>>> of an
    >>>>>>> array
    >>>>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    >>>>>>> }
    >>>>>>>
    >>>>>> This is a clear indication of how screwed up you are. Please read the
    >>>>>> following :
    >>>>>>
    >>>>>> "the newexpression yields a pointer to the initial element (if any)
    >>>>>> of the
    >>>>>> array. [Note: both new int and new int[10] have type int* and the
    >>>>>> type
    >>>>>> of new int[10] is
    >>>>>> int (*)[10]. ]"
    >>>>>>
    >>>>>>
    >>>>>> The standards define both of these types to be pointers to the array,
    >>>>>> they are just different *types* of pointer.

    >
    > The Standard defines the type of the first new-expression in that example
    > to be a pointer to a scalar type (int) and the second to be a pointer to
    > an array.
    >


    The standard defines that both types to point to the initial elelment of the
    array, the only difference is that one is a multi-dimesional array and one
    is a single dimension.
    The new expression returns a pointer to the first element of the array ,
    that is a pointer to the array, regardless of what type it is.

    You still do not understand the implications of E1[E2] being identical to
    *((E1)+(E2)). This means the E1 will always be a pointer of type int* for a
    1dimensional array of int. Whether its implicitly converted in case of
    static arrays, or doesn't need to be converted for dynamic arrays.

    int (*E1)[16] = new int[3][16];
    int* E1 = new int[16];

    E1 in the first example is no more a pointer to the array than in the second
    example, both of these pointer types point to an array, and both of them are
    dereferenced to an object of type exactly:
    ArrayDim-1, for example:
    If E1 was a 3Dim array dereferncing E1 would produce a 2Dim array
    If E1 was a 2Dim array dereferencing it would produce a 1Dim array
    If E1 was a 1Dim array , dereferencing it would produce the base object
    type.


    ALthough I can't help feeling ima wasting my time speaking to you because
    you repeatedly reply with idiotic nonsense and utter bullshit. No doubt the
    same sort of reply will be seen to this post.




    >>>>>>

    >> PROVEN WRONG !!

    >
     
    Paul, Mar 18, 2011
    #12
  13. Paul

    Paul Guest

    "Leigh Johnston" <> wrote in message
    news:...
    > On 18/03/2011 18:36, Paul wrote:
    >>
    >>>>>>>> <snip>
    >>>>>>>>> I hope you are a troll; I really do; if you aren't a troll and you
    >>>>>>>>> genuinely believe the garbage you post then your situation is
    >>>>>>>>> probably
    >>>>>>>>> hopeless.
    >>>>>>>>>
    >>>>>>>>> /Leigh
    >>>>>>>>>
    >>>>>>>>
    >>>>>>>> Leigh you have nothing sensible to say because I have once again
    >>>>>>>> PROVEN
    >>>>>>>> YOU WRONG.
    >>>>>>>> Now why don't you shut up and quietly go away and accept that
    >>>>>>>> instead of
    >>>>>>>> behaving like a 6 year old child who had their sweeties taken .
    >>>>>>>>
    >>>>>>>
    >>>>>>> The way you repeatedly describe yourself when trying to insult
    >>>>>>> others
    >>>>>>> is quite uncanny.
    >>>>>>>
    >>>>>>>>>>> Maybe the following will help you understand the semantic
    >>>>>>>>>>> differences
    >>>>>>>>>>> involved:
    >>>>>>>>>>>
    >>>>>>>>>>> int main()
    >>>>>>>>>>> {
    >>>>>>>>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element
    >>>>>>>>>>> of an
    >>>>>>>>>>> array
    >>>>>>>>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    >>>>>>>>>>> }
    >>>>>>>>>>>
    >>>>>>>>>> This is a clear indication of how screwed up you are. Please read
    >>>>>>>>>> the
    >>>>>>>>>> following :
    >>>>>>>>>>
    >>>>>>>>>> "the newexpression yields a pointer to the initial element (if
    >>>>>>>>>> any)
    >>>>>>>>>> of the
    >>>>>>>>>> array. [Note: both new int and new int[10] have type int* and the
    >>>>>>>>>> type
    >>>>>>>>>> of new int[10] is
    >>>>>>>>>> int (*)[10]. ]"
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>> The standards define both of these types to be pointers to the
    >>>>>>>>>> array,
    >>>>>>>>>> they are just different *types* of pointer.
    >>>>>>>>>>
    >>>>>> PROVEN WRONG !!
    >>>>>
    >>>>> What have I been proven wrong about exactly? Where is this proof? BTW
    >>>>> "pointer to the initial element of an array" is not the same as
    >>>>> "pointer to an array".
    >>>>>
    >>>>>> I have nothing more to say , shut up and go away child.
    >>>>>
    >>>>> Look in the mirror if you want to see something childish.
    >>>>>
    >>>>>>>>> Maybe the following will help you understand the semantic
    >>>>>>>>> differences
    >>>>>>>>> involved:
    >>>>>>>>>
    >>>>>>>>> int main()
    >>>>>>>>> {
    >>>>>>>>> int* p1 = new int[42]; // 'p1' is a pointer to the first element
    >>>>>>>>> of an
    >>>>>>>>> array
    >>>>>>>>> int (*p2)[42] = new int[1][42]; // 'p2' is a pointer to an array
    >>>>>>>>> }
    >>>>>>>>>
    >>>>>>>> This is a clear indication of how screwed up you are. Please read
    >>>>>>>> the
    >>>>>>>> following :
    >>>>>>>>
    >>>>>>>> "the newexpression yields a pointer to the initial element (if any)
    >>>>>>>> of the
    >>>>>>>> array. [Note: both new int and new int[10] have type int* and the
    >>>>>>>> type
    >>>>>>>> of new int[10] is
    >>>>>>>> int (*)[10]. ]"
    >>>>>>>>
    >>>>>>>>
    >>>>>>>> The standards define both of these types to be pointers to the
    >>>>>>>> array,
    >>>>>>>> they are just different *types* of pointer.
    >>>
    >>> The Standard defines the type of the first new-expression in that
    >>> example to be a pointer to a scalar type (int) and the second to be a
    >>> pointer to an array.
    >>>

    >>
    >> The standard defines that both types to point to the initial elelment of
    >> the array, the only difference is that one is a multi-dimesional array
    >> and one is a single dimension.
    >> The new expression returns a pointer to the first element of the array ,
    >> that is a pointer to the array, regardless of what type it is.

    >
    > The first element of an array is not the same thing as the array which
    > contains the element. int* is not a pointer to an array, int* is a
    > pointer to a scalar type (int).
    >


    It *IS* a pointer the the array. How can it point to any part of the array
    yet not point to the array?
    As I predicited a completely idiotic nonsensical response.


    >>
    >> You still do not understand the implications of E1[E2] being identical
    >> to *((E1)+(E2)). This means the E1 will always be a pointer of type int*
    >> for a 1dimensional array of int. Whether its implicitly converted in
    >> case of static arrays, or doesn't need to be converted for dynamic
    >> arrays.

    >
    > No it doesn't. An array is not a pointer and a pointer is not an array;
    > an array can be converted to a pointer however.
    >

    The standard agrees with me not you ref:
    "If the * operator, either explicitly or implicitly as a result of
    subscripting, is applied to
    this pointer, the result is the pointedto (n - 1 )dimensional array, which
    itself is immediately converted
    into a pointer."

    Once agian you are proven wrong.



    >>
    >> int (*E1)[16] = new int[3][16];
    >> int* E1 = new int[16];
    >>
    >> E1 in the first example is no more a pointer to the array than in the
    >> second example, both of these pointer types point to an array, and both
    >> of them are dereferenced to an object of type exactly

    >
    > E1 is a pointer to an array in the first example; in the second example it
    > is not a pointer to an array as it is a pointer to a scalar type (int).

    Look another idiotic response ^^
    >
    > :
    >> ArrayDim-1, for example:
    >> If E1 was a 3Dim array dereferncing E1 would produce a 2Dim array
    >> If E1 was a 2Dim array dereferencing it would produce a 1Dim array
    >> If E1 was a 1Dim array , dereferencing it would produce the base object
    >> type.

    >
    > Correct; well almost; each dereference produces a reference of the
    > corresponding array element type. The problem here is not your
    > understanding of how arrays work at the most basic level; the problem here
    > is the language you have been using to express your understanding; the
    > language you have been using has been plain incorrect.
    >

    I know it's correct I'm telling you how it works.
    >>
    >>
    >> ALthough I can't help feeling ima wasting my time speaking to you
    >> because you repeatedly reply with idiotic nonsense and utter bullshit.
    >> No doubt the same sort of reply will be seen to this post.

    >
    > You are failing to acknowledge that the language you use to express
    > technical C++ matters is irking all those who reply to your posts. Your
    > insults will not help you improve your understanding of technical matters
    > nor help you express yourself properly.
    >

    As I predicited mostly idiotic responses , no wonder I simply get pissed off
    with this idiot half the time and simply tell him to f off for lack of a
    better expression.
     
    Paul, Mar 18, 2011
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David C
    Replies:
    0
    Views:
    324
    David C
    Dec 15, 2004
  2. zetasum
    Replies:
    2
    Views:
    404
    Rhino
    Feb 28, 2005
  3. Arm7
    Replies:
    1
    Views:
    320
    Juha Nieminen
    Aug 28, 2008
  4. rogerp
    Replies:
    0
    Views:
    564
    rogerp
    Mar 22, 2009
  5. rogerp
    Replies:
    0
    Views:
    594
    rogerp
    Mar 22, 2009
Loading...

Share This Page