From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756197Ab1AaRDj (ORCPT ); Mon, 31 Jan 2011 12:03:39 -0500 Received: from mail-iw0-f174.google.com ([209.85.214.174]:55270 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754160Ab1AaRDh (ORCPT ); Mon, 31 Jan 2011 12:03:37 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=oLu3x+wPDOFt8dHo7UDOMcQUe2XV8+BpMQ+bIScnyhFA/C8LRUWhT5Z+QHAX9SSC+/ ygMJSy7kp8wshU/BnGxDh1cn5hLJ8B0WoSnDMGGpFAoHSCQp8UQi7WuEouihYKvvF6hJ CIWw8Heb8noctdoLljgj71S8bZ5QWjjOI2cuM= MIME-Version: 1.0 Date: Mon, 31 Jan 2011 12:03:37 -0500 Message-ID: Subject: typecheck code From: Sri Ram Vemulpali To: Kernel-newbies , linux-kernel-mail Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, /* * Check at compile time that something is of a particular type. * Always evaluates to 1 so you may use it easily in comparisons. */ #define typecheck(type,x) \ ({ type __dummy; \ typeof(x) __dummy2; \ (void)(&__dummy == &__dummy2); \ 1; \ }) #define typecheck_fn(type,function) \ ({ typeof(type) __tmp = function; \ (void)__tmp; \ }) Can anyone help me, explain the above code typecheck. How does (void)(&__dummy == &__dummy2) evaluates to 1 I appreciate any explain. -- Regards, Sri.