From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751098AbWDXWJD (ORCPT ); Mon, 24 Apr 2006 18:09:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751134AbWDXWJD (ORCPT ); Mon, 24 Apr 2006 18:09:03 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.31.123]:40853 "EHLO atrey.karlin.mff.cuni.cz") by vger.kernel.org with ESMTP id S1751098AbWDXWJC (ORCPT ); Mon, 24 Apr 2006 18:09:02 -0400 Date: Tue, 25 Apr 2006 00:09:01 +0200 From: Martin Mares To: marty fouts Cc: Kyle Moffett , linux-kernel@vger.kernel.org Subject: Re: Compiling C++ modules Message-ID: References: <1145911546.1635.54.camel@localhost.localdomain> <444D3D32.1010104@argo.co.il> <9f7850090604241450w885fa98v36657ba5f12f071c@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9f7850090604241450w885fa98v36657ba5f12f071c@mail.gmail.com> User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hello! > Oh, and yeah, a = b + c *is* more readable than > > a = malloc(strlen(b) + strlen(c)); > strcpy(a,b); > strcat(a,c); > > and contains fewer bugs ;) Actually, it contains at least the bug you have made in your C example, that is forgetting that malloc() can fail. So can string addition, if allocated dynamically. Have a nice fortnight -- Martin `MJ' Mares http://atrey.karlin.mff.cuni.cz/~mj/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth "This quote has been selected randomly. Really." -- M. Ulrichs