From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33E4745482; Mon, 17 Jun 2024 16:38:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F0144028B; Mon, 17 Jun 2024 16:38:59 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by mails.dpdk.org (Postfix) with ESMTP id 2117F4028A for ; Mon, 17 Jun 2024 16:38:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718635137; x=1750171137; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=HYpi/ehHSzAtX+gNOn5FquGUmA21HhIJe9C/FxzbpZY=; b=FeMPDIomvOUCGKMZUFz/0ipWsHeU6AizSsqUa6VKnvDcVHlyU91F6elh 2CI7zsZcjNTBsPbAdLTEcnIXo+Vr1jvuVKslGwUMvXgaO+qJcl0Y9lsvn eyPLzgn8FpIDPMqut9+tDRuNDww1LgPx71y+Kje7xBeGSKlSfTFZFMXPt WxKzygnRD2vS1WyaMsNwbNqhlTWGvmWDwqakq7Q5ddUzy5/9qABYw8h3l 3NwajbFymkFAngkOSKZhB3LusAl1RYkAKY0WFyp4CKuvRRzqW3XC/Adj4 6VBFcDR15yQKtxZ16+I5wC6D1PSD6aqsYSAP+gYLoXoPYKJ77OdzdiRzB w==; X-CSE-ConnectionGUID: 8Z8y0GHfTCyorMEJbXKFMw== X-CSE-MsgGUID: kqmj5JcYTF2nd9H6VAYMfg== X-IronPort-AV: E=McAfee;i="6700,10204,11106"; a="26040690" X-IronPort-AV: E=Sophos;i="6.08,244,1712646000"; d="scan'208";a="26040690" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2024 07:38:56 -0700 X-CSE-ConnectionGUID: +IWAueq1S3CVl6byV+awdg== X-CSE-MsgGUID: rnXrsR1fR4+YTZb5bPlUrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,244,1712646000"; d="scan'208";a="41302109" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmviesa009.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Jun 2024 07:38:55 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 17 Jun 2024 07:38:54 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Mon, 17 Jun 2024 07:38:54 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.47) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 17 Jun 2024 07:38:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=htMrqG1H/QBZmCflijLj2ML5792wTuHNwx6sD9CJtJc2R2JsZoFZuJVGuMrZbFwaOkJ/jof4QkRZDOs6JqmbXSazyPnPGdJ0huLhkEaL2jmRTSw749eQm96Z0tvp2gYngc/ZZwo/k5L60iGwFQmWeNx0RsxJKbRSigzqn+fYiR+gdI1HgL7e6CmEk2LGne9aYOnLNIeKcQLSE2VgXZs3zkekXPnqBrKUJL79PnQP91O5fONZSodyMlC3ZT0L9AyEO2X6TGPWXzHeXAviVWnM96S8NqGcVNCbFdL44qLmwvoUsH2f6aMeXX2dcLG6UKe72XQLpb/UhTNWQmc/juhHQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Fg67nj4YF6WhCel0NnV73UdUbn5ZQFjE3f8R2E5b6L0=; b=g1Z42uwWj9uH+mlrOXd/8ucJpuYrrzCA9xfHIaNKIGtjYOSoPLBY05WMdouOeY6wcHtqcxbzKicdVQHoBxx8MfdXR29ZKEx6WPyyc3HtQoqXqJeeaQEEtG936Io7Ih4yCvpsVzREVTnW61VKpUR0KN3V3hPdFgBmNcob0Th7rSdRHwXYgnP3tuUmPje9Jw/59sYoTuL475hHTGqQknqR1OpJz4hCBGkvq/xklAp19Qxy4DAIVnZSDa9VOqmm/LYUYU+tVAXmk12DW7thrADKnaiCNag71pIw8SZvi5HB818BvBX1fWw8+ie+F+nlZo0ctP3L7+CBGVXfhXhinlhRWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by DS0PR11MB6469.namprd11.prod.outlook.com (2603:10b6:8:c3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 14:38:52 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%7]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 14:38:52 +0000 Date: Mon, 17 Jun 2024 15:38:48 +0100 From: Bruce Richardson To: Morten =?iso-8859-1?Q?Br=F8rup?= CC: Subject: Re: Coding Style for local variables Message-ID: References: <98CBD80474FA8B44BF855DF32C47DC35E9F512@smartserver.smartshare.dk> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F512@smartserver.smartshare.dk> X-ClientProxiedBy: DU7PR01CA0041.eurprd01.prod.exchangelabs.com (2603:10a6:10:50e::6) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DS0PR11MB6469:EE_ X-MS-Office365-Filtering-Correlation-Id: bb2234d2-0650-4390-f1b4-08dc8edb350e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|366013|376011|1800799021; X-Microsoft-Antispam-Message-Info: =?iso-8859-1?Q?/oP8URoFtjCrHHdJSRVU+4s2YxccMFtrHpeW/UgUZHE+ad1c8nux90i8xw?= =?iso-8859-1?Q?hKTqY6sieilXjFeNZATEbzBdazwaEkxoIG/vJV13QCcH9SvjICunM76EAK?= =?iso-8859-1?Q?hRun9Hd65k1NuxaBCY6gTRUfxjtj5OlytvgkCjmmrAHJT7eaF/7b+xHhmi?= =?iso-8859-1?Q?xJlPsNdQKPDJeQIaRbBijieuO/w3/I32mXk68SdlSZuqUJRlmwIwFKRSTF?= =?iso-8859-1?Q?WISBjHzHpQO8bD79sGYdJrNpxnwXiCex5aj9jwBmBtIQxPTaFKZtTVffKG?= =?iso-8859-1?Q?M4BhGze+h7PHBJSLCUUGL0cb4pipqLf4jg2OUwqzo4uOrE1RehhuEcuh50?= =?iso-8859-1?Q?AH8vwv3jUJwxxl+zY2n/kX1OxU+iv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8859-1?Q?+2REkkIe35PF0QD91zXtbgVYc32tIFo0a6bhE5OVBXnMHKwn0f0IWfpREr?= =?iso-8859-1?Q?I/VYT9EG3AsUma2iktQ67rZW6nCHTptp29yZ2zUsXlrE/QtxEHkv6yOElr?= =?iso-8859-1?Q?OpHE9aOCPY?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(366013)(376011)(1800799021); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?+fMihj4DYvFgF4yPIWaYGk9kut98qr3f0hrdV41xC/Hmx4AS2w9q04tyrR?= =?iso-8859-1?Q?Av+MiufKvr6CVwLkvt7MDdnT/jz4NZc0w0AV6AGnnOsZ/uuFQZBNFiLz7S?= =?iso-8859-1?Q?rNiK+oOm9ZwI4uKfyITyocX5JTGWWZ1r+pUrvdna7vPP3S7zKkEhuoFfTz?= =?iso-8859-1?Q?9nHSMgNIYvACw+WQZqzxc7giETg6y0dGuy/6lI9q4SL68DoxBB0wvRjTlk?= =?iso-8859-1?Q?6uJcvt5iSWRtcziheLQDx/xfpO2jUEJ85GHQWdSkVP0AUjM+gBEAoZ60SI?= =?iso-8859-1?Q?0yw98fTKfi5tdTyBiF2a8WVw542a6GhzKlUJiW3SBrKT1qjBi576BF445+?= =?iso-8859-1?Q?q0H52FGVLEIEgip7QIA42gqcKhnsgfyVdloE51djMB6m+Gs+M4Vlz4Bbrl?= =?iso-8859-1?Q?vKNVxDN8Qd8RdBtCSRrpSJESnTwcrpvsgkRKdvBT/dZD3AtoC6QuKyt0iu?= =?iso-8859-1?Q?SEdT52IyLNFjsjEY8ZoUBEELx9RKw2+QeW4j6Oe/Ka3F3yAEbk6zqRJdYB?= =?iso-8859-1?Q?U0b7mX7XettbTgxnfW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ki?= =?iso-8859-1?Q?+rKeOXWi/Ku67CsXRTeWkbuH63HOeNPady8Bng3vMXjsJz2XbXN9Syq5Kq?= =?iso-8859-1?Q?3SIw4N3nwLw0tz7KvGSEwmir9XS/2MAkv/qAufQZ2NFgYdlKI0/aObHB0m?= =?iso-8859-1?Q?Vo4DB6E4aRqTcKRhukxKB+kvhhUYq3rzts1mZkL322tuJz4p87G+ecCvj9?= =?iso-8859-1?Q?FPlKohDOySRHbjT70SglLXXGs88yRfvJCuACig2BzQOENQWWTgiPQNMg?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: bb2234d2-0650-4390-f1b4-08dc8edb350e X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 14:38:51.9699 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 46khfe3rA1Nbg2eXw/G9lBMwejhVuUd9IDDshJBhRMo8cQhLwBnbYtOWW7NJ+qj72iMpbmIleth2DmEUzGngWbHe8KvGzdCx9ghZfC9o/Ao= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB6469 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Jun 10, 2024 at 05:10:01PM +0200, Morten Brørup wrote: > The coding style guide says: > > "Variables should be declared at the start of a block of code rather than in the middle. The exception to this is when the variable is const in which case the declaration must be at the point of first use/assignment. Declaring variable inside a for loop is OK." > > Since DPDK switched to C11, variables can be declared where they are used, which reduces the risk of using effectively uninitialized variables. "Effectively uninitialized" means initialized to 0 or NULL where declared, to silence any compiler warnings about the use of uninitialized variables. > > Can we please agree to remove the recommendation/requirement to declare variables at the start of a block of code? > +1 Declaring variables at point of first use is generally easier to read, and makes things far simpler when commenting out blocks of code for devel or debugging purposes - avoid those unused variable warnings. /Bruce