From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 043BE1B99E for ; Fri, 14 Dec 2018 20:10:46 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Dec 2018 11:10:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,354,1539673200"; d="scan'208";a="283643175" Received: from ae13-28.jf.intel.com ([10.166.188.62]) by orsmga005.jf.intel.com with ESMTP; 14 Dec 2018 11:10:44 -0800 Date: Fri, 14 Dec 2018 11:07:13 -0800 From: Jeff Shaw To: Mattias =?iso-8859-1?Q?R=F6nnblom?= Cc: Jeff Shaw , dev@dpdk.org Message-ID: <20181214190713.GB9964@ae13-28.jf.intel.com> References: <20181214163827.9403-1-jeffrey.b.shaw@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Subject: Re: [dpdk-dev] [PATCH] eal: remove variable length array X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2018 19:10:47 -0000 On Fri, Dec 14, 2018 at 07:36:38PM +0100, Mattias Rönnblom wrote: > On 2018-12-14 17:38, Jeff Shaw wrote: > > Compilers that do not support the C11 standard, or do not implement > > gcc extensions, may not support variable length arrays. > > > > VLAs are a C99 thing. You're right, my mistake. > > > The code prior to this commit produced the following warning when > > compiled with "-Wvla -std=c90". > > > > warning: ISO C90 forbids variable length array ‘array’ [-Wvla] > > > > This commit removes the variable length array from the PMD debug > > trace function by allocating memory dynamically on the stack using > > alloca(). > > > > Is alloca() even included in *any* C standard? As far as I see, it just > achieves the same thing in an uglier, less portable way than VLAs. I agree that it is much less elegant than a VLA. This is in preparation for DPDK on Windows, which using the Microsoft Visual C++ (MSVC) compiler. MSVC does not support variable length arrays. It does, however, support alloca(), as does GCC/ICC. For this particular instance, the point is moot, since the function is not used anywhere and can just as easily be removed. Though it does not address the issue for the ~100 other instances where VLAs are used. We will be submitting patches for those as more common files are ported to Windows.