From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] Revert "ALSA: firewire-lib: change structure member with proper type" Date: Thu, 05 Jan 2017 07:34:05 +0100 Message-ID: References: <20170105004131.19202-1-o-takashi@sakamocchi.jp> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 112202654AD for ; Thu, 5 Jan 2017 07:34:07 +0100 (CET) In-Reply-To: <20170105004131.19202-1-o-takashi@sakamocchi.jp> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Sakamoto Cc: alsa-devel@alsa-project.org, clemens@ladisch.de List-Id: alsa-devel@alsa-project.org On Thu, 05 Jan 2017 01:41:31 +0100, Takashi Sakamoto wrote: > > This reverts commit 6b7e95d1336b9eb0d4c6db190ce756480496bd13. This commit > is based on a concern about value of the given parameter. It's expected > to be ORed value with some enumeration-constants, thus often it can not be > one of the enumeration-constants. I understood that this is out of > specification and causes implementation-dependent issues. > > In C language specification, enumerated type can be interpreted as an > integer type, in which all of enumeration-constants in corresponding > enumerator-list can be stored. Implementations can select one of char, > signed int and unsigned int as its type, and this selection is > implementation-dependent. > > In GCC, a signed integer is selected when at least one of > enumeration-constants has negative value, else an unsigned integer is > selected. This behaviour can be switched by -fshort-enums to short type. > Anyway, the type can be decided after scanning all of > enumeration-constants. > > Totally, there's no rules to constrain the value of enumerated type to > be one of enumeration-constants. In short, in enumerated type, decision > of actual type for the type is the most important and > enumeration-constants are just used for the decision, thus it's permitted > to have an integer value in a range of enumeration-constants. In our case, > actual type for the type is currently deterministic to be either char or > unsigned int. Under GCC, it's unsigned int. You sign-off is missing. Takashi