Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752539AbcCBNX3 (ORCPT ); Wed, 2 Mar 2016 08:23:29 -0500 Received: from mail.kernel.org ([198.145.29.136]:47990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752268AbcCBNX1 (ORCPT ); Wed, 2 Mar 2016 08:23:27 -0500 Date: Wed, 2 Mar 2016 10:23:23 -0300 From: Arnaldo Carvalho de Melo To: Peter Zijlstra Cc: Colin King , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf tests: initialize sa.sa_flags Message-ID: <20160302132323.GP3604@kernel.org> References: <1456923322-29697-1-git-send-email-colin.king@canonical.com> <20160302125901.GF6356@twins.programming.kicks-ass.net> <20160302130350.GO3604@kernel.org> <20160302132127.GG6356@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160302132127.GG6356@twins.programming.kicks-ass.net> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 920 Lines: 33 Em Wed, Mar 02, 2016 at 02:21:27PM +0100, Peter Zijlstra escreveu: > On Wed, Mar 02, 2016 at 10:03:50AM -0300, Arnaldo Carvalho de Melo wrote: > > > Would not something like: > > > > > > sa = (struct sigaction){ > > > .sa_sigaction = segfault_handler, > > > }; > > > sigfillset(&sa.sa_mask); > > > > > > Be better? > > > > I thought about that, but isn't that set in stone? This would be a 4 > > liner, while his is a one' :-) > > Dunno, you're right that its rather unlikely struct sigaction is going > to grow another member, but I like the above pattern better in general, > makes it harder to end up with uninitalized bits. > > When performance matters the above pattern isn't ideal, but that should > not be a concern here. Right, I also always use : struct foo bar = { .baz = 1, .name = "whatever", }; Even more compact than using that cast. But didn't bother changing in this case. - Arnaldo