(int)(void*)(int) 64 vs 32

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Harald Welte laforge at gnumonks.org
Wed Feb 24 22:38:36 UTC 2016


On Wed, Feb 24, 2016 at 08:07:21PM +0100, Neels Hofmeyr wrote:
> On my 64bit system, I get warnings about casting int to pointer of
> different size and vice versa. However, below patch only shifts the
> warnings to 32bit systems, right?

I don't think so.  'long' typically corresponds to the pointer size, at
least based on my experience.  Of course the C standard doesn't give you
any guarantees and just states that it should be at least the size of a
signed 32bit integer.

according to page 6 of
http://www.agner.org/optimize/calling_conventions.pdf the only practical
exception seems to be windows, where on 64bit even a 'long' is only
32bit ;)

The more interesting question is probably why is vty->index not pointing
to 'struct osmo_msc_data' in the first place?  That's what we typically
use, rather than storing integers in the pointer and then perfomring
lookups on that.  Holger?

-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)



More information about the OpenBSC mailing list