CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 16

Threaded View

  1. #1
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    another compiler bug?

    i got the folowing code:

    Code:
    unsigned int val1;
    void* ptr1 = (void*)val1;
    void* ptr2;
    ptr1 += ptr2;
    then i get the errors:

    '+=' : illegal, right operand has type 'void *'
    '+=' : pointer on left; needs integral value on right
    1. pointers ARE integers.
    2. ptr + ptr works why doesnt ptr += ptr?

    is the compiler confused because of the int to ptr? (wich i had to type cast, even though pointers are integral)
    Last edited by Mitsukai; July 24th, 2006 at 05:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured