LWN.net Logo

The __nocast attribute

The __nocast attribute

Posted Mar 31, 2005 4:44 UTC (Thu) by iabervon (subscriber, #722)
Parent article: The __nocast attribute

Does this also prevent an size_t value from being sent as an unsigned int in cases when size_t is a typedef for unsigned int? If so, it would prevent the error of swapping the arguments to kmalloc in cases where a chunk of 128 bytes is needed with GFP_KERNEL, and instead 208 bytes are allocated using filesystems but not I/O or waiting.


(Log in to post comments)

The __nocast attribute

Posted Mar 31, 2005 16:27 UTC (Thu) by joern (subscriber, #22392) [Link]

__bitwise would be the attribute for what you describe.

The __nocast attribute

Posted Mar 31, 2005 17:38 UTC (Thu) by iabervon (subscriber, #722) [Link]

__bitwise would also be appropriate, and I'm actually fairly surprised that kmalloc doesn't have it already, but there are also applications for a distinction between size of element and number of elements, which a __nocast that made your size_t arguments have to come from size_t variables (or sizeof expressions, more often) would catch.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds