Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765512AbXEYVcV (ORCPT ); Fri, 25 May 2007 17:32:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758932AbXEYVcO (ORCPT ); Fri, 25 May 2007 17:32:14 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:51992 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756788AbXEYVcO (ORCPT ); Fri, 25 May 2007 17:32:14 -0400 Date: Fri, 25 May 2007 22:32:13 +0100 From: Al Viro To: Satyam Sharma Cc: Linux Kernel Mailing List Subject: Re: double exclamation (!!) suckage in the kernel Message-ID: <20070525213213.GM4095@ftp.linux.org.uk> References: <20070525204127.GK4095@ftp.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 809 Lines: 22 On Sat, May 26, 2007 at 02:26:11AM +0530, Satyam Sharma wrote: > also be brave enough to take a C quiz here :-) > > > what type should x have for !!x to be a valid expression? > > Any integer type (includes pointers) Er, no... Pointers are not integer types *and* you can use ! on any scalar type (including floating ones, even though it's not particulary useful there). > > what will be the type of result? > > int (I guess boolean for C99?) Actually, ! and comparisons still give int in C99 (and !x is defined as (x == 0) in all situations). - 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/