From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751895AbbCTLnP (ORCPT ); Fri, 20 Mar 2015 07:43:15 -0400 Received: from esgaroth.petrovitsch.at ([78.47.184.11]:5975 "EHLO esgaroth.tuxoid.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbbCTLnM (ORCPT ); Fri, 20 Mar 2015 07:43:12 -0400 Subject: Re: [PATCH] x86,boot: standardize strcmp() From: Bernd Petrovitsch To: Arjun Sreedharan Cc: "H. Peter Anvin" , Ingo Molnar , Thomas Gleixner , Ingo Molnar , x86@kernel.org, "linux-kernel@vger.kernel.org" Date: Fri, 20 Mar 2015 12:42:18 +0100 In-Reply-To: <550B08A3.70504@zytor.com> References: <1426520267-1803-1-git-send-email-arjun024@gmail.com> <20150317074608.GB27687@gmail.com> <550B08A3.70504@zytor.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.0.3 (3.0.3-1.fc15) Content-Transfer-Encoding: 7bit Message-ID: <1426851739.20946.18.camel@thorin> Mime-Version: 1.0 X-DCC-wuwien-Metrics: esgaroth.tuxoid.at 1290; Body=7 Fuz1=7 Fuz2=7 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.4 SARE_SUB_6CONS_WORD subject word consists of consecutive consonants * -0.2 AWL AWL: Adjusted score from AWL reputation of From: address Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Don, 2015-03-19 at 10:34 -0700, H. Peter Anvin wrote: > On 03/17/2015 07:13 AM, Arjun Sreedharan wrote: > > On a related note, IMO strcmp() should return {-1,0,1} since many > > programmers just expect this behavior. just my opinion. One doesn't change an API just for a claimed expection for an unprooved number of cases. > I would challenge that assumption, *especially* in the context of kernel > programming. Let's not waste time on that crap. Even if the assumption is correct (which I'm not implying - quite the opposite), than these programmers are not well educated enough and - thus;-) - write buggy code. They also fail to strive for mot possible robustness. BTW POSIX' strcmp() description on http://pubs.opengroup.org/onlinepubs/9699919799/functions/strcmp.html als states "> 0, == 0 or < 0" (and ISO-C seem to also see it that way). Kind regards, Bernd -- "I dislike type abstraction if it has no real reason. And saving on typing is not a good reason - if your typing speed is the main issue when you're coding, you're doing something seriously wrong." - Linus Torvalds