Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 7 Nov 2000 19:29:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 7 Nov 2000 19:29:49 -0500 Received: from 4dyn176.delft.casema.net ([195.96.105.176]:63498 "EHLO abraracourcix.bitwizard.nl") by vger.kernel.org with ESMTP id ; Tue, 7 Nov 2000 19:29:37 -0500 Message-Id: <200011080029.BAA06851@cave.bitwizard.nl> Subject: Re: malloc(1/0) ?? In-Reply-To: <20001107104634.G13151@mea-ext.zmailer.org> from Matti Aarnio at "Nov 7, 2000 10:46:34 am" To: Matti Aarnio Date: Wed, 8 Nov 2000 01:29:27 +0100 (MET) CC: Lyle Coder , David Schwartz , RAJESH BALAN , linux-kernel@vger.kernel.org From: R.E.Wolff@BitWizard.nl (Rogier Wolff) X-Mailer: ELM [version 2.4ME+ PL60 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Matti Aarnio wrote: > needed size is bound to get user burned. malloc(0) is insane thing > (IMO), but at least glibc supports it for some reason. Likely just due > to padding and minimum size issues. Part of the desing of the C language and the library is intended to make boundary conditions go well automatically. So, a program that does: fscanf (file, "%d", &numsquares); squares = malloc (sizeof (struct square) * numsquares); for (i=0;i