[Gllug] Re: invalid type argument of `unary *'

Ian B ian.b at albany.uk.com
Sun Feb 19 18:02:39 UTC 2006


On Sat, 2006-02-18 at 23:24 +0000, Adrian McMenamin wrote:
> I know this question makes me look a hopeless C programmer, but there
> you go.
> 
> Why won't this compile? (I want to know what is in the address
> 0xa0811000)
> 
>         long uBuf = 0xa0811000;
>         snd_printk("Buffer starts with %X\n", *uBuf);

This works for me:
	long *uBuf = (long *) 0xa0811000;
	printf("Buffer at %X starts with %X\n",uBuf,*uBuf);

The compiler needs to know that the mem address is being used as a
pointer, else it assumes it's a urinary value and takes the p*ss.

My example uses printf because I don't know anything about snd_printk.

HTH
	Ian B.


-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list