Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932071AbXEYVhb (ORCPT ); Fri, 25 May 2007 17:37:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1765614AbXEYVhS (ORCPT ); Fri, 25 May 2007 17:37:18 -0400 Received: from wr-out-0506.google.com ([64.233.184.229]:15617 "EHLO wr-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755888AbXEYVhP (ORCPT ); Fri, 25 May 2007 17:37:15 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=SJaI81XGfN4qaCq1HrxaflwfuAJLD7up8lyWqfzu5c5DF+FLqf4WYrCdyqBllz3eIW8Akq+bV9jBzlIdzxMxi7LalCtyA9b4eK7+bWEgtd05fTINLsXzd3yge134nT+X4QNuR8tWobfXFBHpyfeIg9KqNA5T4KE2yIUnwlN2STQ= Message-ID: Date: Sat, 26 May 2007 03:07:15 +0530 From: "Satyam Sharma" To: "Al Viro" Subject: Re: double exclamation (!!) suckage in the kernel Cc: "Linux Kernel Mailing List" In-Reply-To: <20070525213213.GM4095@ftp.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070525204127.GK4095@ftp.linux.org.uk> <20070525213213.GM4095@ftp.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 999 Lines: 29 On 5/26/07, Al Viro wrote: > 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). Yeah, I noticed this (with a sample program) just after the quiz ... > > > 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). Hmm, thanks for explaining this. Satyam - 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/