Subject: Re: some code assumes sizeof(char *) == sizeof(int)
To: None <email@example.com, firstname.lastname@example.org>
From: None <email@example.com>
Date: 02/22/2001 16:43:19
> The correct fix is probably to change the macro to:
> #define unwind_protect_int(X) \
> unwind_protect_var(&(X), (char *)(unsigned long)(X), sizeof(X))
> (The `unsigned' is optional, but correctly converts 32-bit pointers
> to 64-bit pointers. But then we're probably not dealing with pointers
I'll test this later.
But this doesn't fix warning at:
*(sv->variable) = (int)sv->desired_setting;
because sv->desired_setting is char *, converting 64bit value to 32bit value.
Then change that to:
*(sv->variable) = (long)sv->desired_setting;