Typecasting a void pointer to unsigned long in zsmalloc.c
Quoted 3 lines
Quoted 1 line
Shouldn't there be a special type for doing this type of conversion?
That type is "unsigned long" :)
Wouldn't "uintptr_t" be a more explicit type for storing pointer addresses as integers? It seems to me it has the advantage of expressing intent better for us human readers. See <linux/types.h>. Yes, it is currently defined as an "unsigned long."
_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Quoted 5 lines · Alex Hogen
Quoted 3 lines
Quoted 1 line
Shouldn't there be a special type for doing this type of conversion?
That type is "unsigned long" :)
Wouldn't "uintptr_t" be a more explicit type for storing pointer addresses as integers? It seems to me it has the advantage of expressing intent better for us human readers. See <
linux/types.h>. Yes, it is currently defined as an "unsigned long."
"unitptr_t" came years, if not decades, after the policy of "a pointer fits into an unsigned long" was the rule (i.e. from the very first release of Linux.
And those crazy _t types are for userspace code, don't use them in the kernel, there's no need.
thanks,
greg k-h
_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies