This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Different multiply operator for pointers and integers
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Laura Tosoratto'" <Laura dot Tosoratto at roma1 dot infn dot it>,<gcc at gcc dot gnu dot org>
- Cc: "'Alessandro Lonardo'" <alessandro dot lonardo at roma1 dot infn dot it>
- Date: Thu, 16 Dec 2004 18:42:18 -0000
- Subject: 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....