LWN.net Logo

Workqueues and internal API conventions

Workqueues and internal API conventions

Posted Aug 31, 2006 22:05 UTC (Thu) by giraffedata (subscriber, #1954)
Parent article: Workqueues and internal API conventions

This convention goes against the normal C conventions for boolean values - a "false" value means that everything is OK

This is a strange observation. First, there's no C convention that a "false" boolean value means "something's wrong," and second, there's no C convention that the return code of a function is a boolean value.

The strongest C convention for return codes, which is actually older than C, is that the return code is an error code -- it tells what's wrong. 0 is a value that naturally says, "nothing."


(Log in to post comments)

Workqueues and internal API conventions

Posted Sep 7, 2006 10:12 UTC (Thu) by anandsr21 (guest, #28562) [Link]

The reasoning for the Unix convention is that success can only happen in one way while Failure can happen in a number of ways. Also it can only be the unique number 0 because other's will not be able to fulfill the requirement for uniqueness as there are many negative numbers and many positive numbers. I also use this convention for my code. Unless the function name implies a test it should follow this condition.

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