type safe lists (was Re: PATCH: type safe(r) list_entry repacement: generic_out_cast)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines
As long as your pointers are 32bit this seems to be ok. But on 64bit implementations pointers are not (unsigned long) so this cast seems to be wrong.
A pointer fits into unsigned long on all 64bit linux ports. The kernel very heavily relies on that.
You are probably thinking of Win64, but this is not Windows.
-Andi
Quoted 7 lines · Andi Kleen
Quoted 4 lines
As long as your pointers are 32bit this seems to be ok. But on 64bit implementations pointers are not (unsigned long) so this cast seems to be wrong.
A pointer fits into unsigned long on all 64bit linux ports. The kernel very heavily relies on that.
Not just the kernel, afaik. I think it's rather tightly integrated into gcc internals too (ie pointers are eventually just converted to SI inside the compiler, and making a non-SI pointer would be hard).
Linus
Quoted 10 lines · Linus Torvalds
Quoted 6 lines
Quoted 3 lines
As long as your pointers are 32bit this seems to be ok. But on 64bit implementations pointers are not (unsigned long) so this cast seems to be wrong.
A pointer fits into unsigned long on all 64bit linux ports. The kernel very heavily relies on that.
Not just the kernel, afaik. I think it's rather tightly integrated into gcc internals too (ie pointers are eventually just converted to SI inside the compiler, and making a non-SI pointer would be hard).
That can't be the case, as how would GCC represent 64-bit pointers on platforms like the Alpha, which support 64-bit, 32-bit, 16-bit and 8-bit types? 64-bits must be DImode simply because QImode is the smallest mode, and required for the 8-bit type.
-- Jamie