[Top][All Lists]

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

Re: [avr-gcc-list] Casting

From: Russell Shaw
Subject: Re: [avr-gcc-list] Casting
Date: Tue, 28 Mar 2006 23:33:46 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060205 Debian/1.7.12-1.1

Ron wrote:
I am using a <long> as a parameter in which I pass various entities,
sort of like a mailbox. Mostly they are longs, sometimes integers, and
sometimes I need to pass a pointer. In the latter case a cast to long
does not wholly satisfy the compiler (3.4.5), due to the size difference
on AVRs, thus giving the warning:

"cast from pointer to integer of different size"

It is only a warning and the program works fine. However I would like to
see a clean compile and so have been trying to find a combination of
casts that would promote a pointer to a long, but to no avail. Does
anyone have a suggestion?

How about:

  myfunc(long int param);

  void *ptr;

  myfunc((unsigned long int)((unsigned int)ptr))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]