> -----Original Message-----
> From: 
> [EMAIL PROTECTED]
> Sent: 28 March 2006 12:47
> To: [email protected]
> Subject: [avr-gcc-list] Casting
> 
> 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?
> 
> Ron

Yep.

typedef union
 {
 long  a_long;
 int   an_int;
 void  *a_pointer;
 } messy_var_t;

typedef struct
 {
 messy_var_t var;
 uint8_t     tag;   //to indicate what the union (var) contains
 } parameter_t;

void fn1 (parameter_t p1)
{
blah.. ;
blah.. ;
blah.. ;
}


I didn't actually compile this but you'll get the idea, I'm sure.



Regards

Nigel Winterbotom



_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to