Re: Errors with ->*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1) a .* xptr = 3 ;
   Above line's syntax is wrong.
 Should be
        *a.xptr = 3;

2) Also declare the structure member variables as
         int *xptr, *yptr ; (otherwise yptr will be of type int, not of int*)


3)  aptr ->* xptr = 5 ;
      is also of wrong syntax.
      Should be
                 *aptr->xptr = 5 ;

Which is equivalent to
               *(aptr->xptr) = 5;



the above code DOES NOT mean this one :

             (*aptr)->xptr   // this one dereference aptr first, then
does nothing to xptr



Thanks.

On Tue, Aug 2, 2011 at 10:01 PM, Shriramana Sharma <samjnaa@xxxxxxxxx> wrote:
>
> Hello -- long time since I posted on this list.
>
> I'm trying to understand the use of ->* but in compiling the attached program which I thought was straightforward I am getting the following errors:
>
> foo.cpp: In constructor ‘mystruct::mystruct()’:
> foo.cpp:9:12: error: invalid conversion from ‘int*’ to ‘int’
> foo.cpp: In function ‘int main()’:
> foo.cpp:21:7: error: ‘xptr’ was not declared in this scope
> foo.cpp:22:7: error: ‘yptr’ was not declared in this scope
>
> Please help.
>
> --
> Shriramana Sharma
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux