LWN.net Logo

RFC: Typesafe callbacks

From:  Rusty Russell <rusty@rustcorp.com.au>
To:  Linus Torvalds <torvalds@linux-foundation.org>
Subject:  [PATCH 0/6] RFC: Typesafe callbacks
Date:  Sun, 20 Jan 2008 20:46:13 +1100
Message-ID:  <200801202046.14746.rusty@rustcorp.com.au>
Cc:  Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org, Jeff Garzik <jeff@garzik.org>, Tejun Heo <htejun@gmail.com>
Archive-link:  Article, Thread

Hi all,

   Converting to and from void * for callback functions loses type safety: 
everywhere else we expect the compiler to catch incorrect pointer types 
handed to functions.

   It's pretty simple to create typesafe callback functions using typeof, and 
with a little gcc trickery we can allow both old-style and typesafe callbacks 
to avoid churn on commonly-used routines.

Feedback welcomed,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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