This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Different multiply operator for pointers and integers


> -----Original Message-----
> From: gcc-owner On Behalf Of Dave Korn
> Sent: 16 December 2004 18:32

> > Yes, those registers _can_ hold integers but they _must_ hold 
> > pointers.
> > The mult_i instruction must be used when operands are 
> > integers, and the 
> > mult_a instruction must be used when one of the operands is 
> a pointer.


  Oh, BTW, my original curiousity still stands:  I can't think of any
circumstances in which multiplying two pointers (or a pointer and an integer)
would make sense.

dk@mace /test/pointers> cat ptr.c

char *foo (char *bar, char *baz)
{
        return bar * baz;
}

char *plugh (char *xyzzy)
{
        return xyzzy * 37;
}

dk@mace /test/pointers> gcc -c ptr.c
ptr.c: In function `foo':
ptr.c:4: error: invalid operands to binary *
ptr.c: In function `plugh':
ptr.c:9: error: invalid operands to binary *
dk@mace /test/pointers>

  See what I mean?  Would you mind giving me an example, so I don't have to sit
up all night wondering what on earth it could be? :)

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]