From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= Subject: Re: [PATCH] eal: remove variable length array Date: Fri, 14 Dec 2018 21:28:05 +0100 Message-ID: <3a573b56-6ea0-812c-4641-830fbd3c59cc@ericsson.com> References: <20181214163827.9403-1-jeffrey.b.shaw@intel.com> <20181214190713.GB9964@ae13-28.jf.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: Jeff Shaw Return-path: Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by dpdk.org (Postfix) with ESMTP id 5C0C81B91F for ; Fri, 14 Dec 2018 21:28:09 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id CBDFA4001F for ; Fri, 14 Dec 2018 21:28:08 +0100 (CET) In-Reply-To: <20181214190713.GB9964@ae13-28.jf.intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 2018-12-14 20:07, Jeff Shaw wrote: >>> 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. > If Microsoft's C compiler doesn't support C99, some 20 years after its release, maybe it's time to find a new compiler, instead of messing up the DPDK code in a ~100 instances.