Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755255AbeAMQYs (ORCPT + 1 other); Sat, 13 Jan 2018 11:24:48 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:42000 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754998AbeAMQYp (ORCPT ); Sat, 13 Jan 2018 11:24:45 -0500 X-Google-Smtp-Source: ACJfBosDDLKwmnVWpfycwVW2YuYnFtYURWdUQCntCbpbSlh/u2Xe+66TsHEZp9+xSPBO8aYvdMxSAg== Date: Sat, 13 Jan 2018 08:24:41 -0800 From: Alexei Starovoitov To: Karim Eshapa Cc: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: bpf: Change structure passing and assignment Message-ID: <20180113162439.jfsxlotivq3wncmu@ast-mbp> References: <1515847339-4712-1-git-send-email-karim.eshapa@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1515847339-4712-1-git-send-email-karim.eshapa@gmail.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sat, Jan 13, 2018 at 02:42:19PM +0200, Karim Eshapa wrote: > I noticed that most of functions here have structure arguements and return structure, all these structures passed and returned are delt in passing and assignment like memcpy a structure.In addition it takes size in stack while passing. so why not we use pointers to structure as argumentsor there is actual need to do such things and you intentionaly want to deal with copies of strucuteres. > ex: > struct tnum tnum_add(struct tnum a, struct tnum b) and how an alternative for the above would look like with pointers ?