From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <52F12761.5070100@siemens.com> Date: Tue, 04 Feb 2014 18:46:09 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <52F1172B.2080500@xenomai.org> <52F11F94.9000309@siemens.com> <52F1231A.7080603@xenomai.org> <52F12442.3040301@xenomai.org> <52F125E8.6020200@xenomai.org> <52F12700.3020400@xenomai.org> In-Reply-To: <52F12700.3020400@xenomai.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] [Xenomai-git] Jan Kiszka : alchemy: Replace static variable no_alchemy_task with macro List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gilles Chanteperdrix , Philippe Gerum Cc: xenomai@xenomai.org On 2014-02-04 18:44, Gilles Chanteperdrix wrote: > On 02/04/2014 06:39 PM, Philippe Gerum wrote: >> On 02/04/2014 06:32 PM, Gilles Chanteperdrix wrote: >>> On 02/04/2014 06:27 PM, Philippe Gerum wrote: >>>> If g++ chokes on the initializer part because it is outdated, then >>>> using >>>> old-fashioned ones may be an option. Actually, I find macroizing this >>>> definition quite bad. >>>> >>>> static const RT_TASK no_alchemy_task = { >>>> - .handle = 0, >>>> - .thread = 0 >>>> + handle: 0, >>>> + thread: 0 >>>> }; >>> >>> No, the previous version is better, it is standard compliant C and C++, >>> the second version is a gcc extension, which works only when compiling >>> C, if I remember correctly. >>> >> >> Recent g++ is happy with both (no -std forced though). But the former is >> allowed by the C++ parser only since recently. >> > > Well, on the other hand: > static const RT_TAKS no_alchemy_task; > > Will zero initialized the structure just as well... True, but older g++ will complain about unused variable. I've seen this with 4.5, currently checking a newer version. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux