From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,c818447ef81c263f X-Google-Attributes: gidfee84,public From: mooney@dogbert.cc.ndsu.NoDak.edu (Tim Mooney) Subject: Re: [Help]gcc ignored #pragma pack on DEC/OSF1 4.0B Date: 1998/01/16 Message-ID: <69n3rl$ivm@dogbert.cc.ndsu.NoDak.edu>#1/1 X-Deja-AN: 316489713 References: <689ng7$ja2@news.seed.net.tw> <34B112CE.6F59@zk3.dec.com> <68shad$195@dogbert.cc.ndsu.NoDak.edu> <34BBE9F2.5BC239F@zk3.dec.com> Organization: North Dakota Higher Education Computing Network (NDHECN) Newsgroups: comp.unix.osf.osf1 [posted and cc'ed] In article <34BBE9F2.5BC239F@zk3.dec.com>, Jeff Sullivan wrote: > Tim Mooney wrote: > > > > 1) it warns about `__inline', and stdio.h uses `__inline', so one gets > > I have verified that this is fixed in Digital UNIX V4.0D. > To test this: > > % cat t.c > #include > % cc -portable t.c -fast -w0 -c > > In this case, -fast expands to (among other things) -D_INTRINSICS > -D_INLINE_INTRINSICS, which will cause the __inline functions to > be enabled in stdio.h. > Thanks Jeff! I unfortunately hadn't had time to isolate the combination of arguments that was causing this when used with `-portable' -- I appreciate you taking the time to investigate this. > > 2) It warns about this: > > GTK_HAS_SHAPE_MASK = 1 << 22 > > in an enum: > > > > In this declaration, the enumeration constant GTK_HAS_SHAPE_MASK > > is out of the range -32768 to 32767. > > Our project leader wrote: > > " > Hmm, I believe Tim Mooney is correct I hear that all the time from *my* boss too. ;-) > about the enum. The only platforms > to which this enumeration constant would be non-portable (under > ANSI C) would be ones on which the type int had fewer than 23 bits. > If -portable complains about this, then it ought to complain > about every int constant that exceeds 16 bits (since that's the > minimum size for int required by the standard). It might be > the case that some compilers implemented enums as 16 bits > even though they had 32-bit ints, and perhaps that's why this > message exists. But our general basis for portability is ANSI C, > and the only way an ANSI compiler could reject this is on the > basis of the size of int - and we don't complain about other > constructs that assume int is at least 32 bits. > > The section you quote "Each enumerated type shall be compatible with an > integer type; the choice of type is implementation-defined." ends with > a comma instead of a period. It goes on to say: "but shall be > capable of representing the values of all the members of the > enumeration". The intent here is to allow the compiler to > look at the list of enum values for a particular enum type, > and choose the integer type with which it will be compatible > based on the values. E.g. for enum bool {TRUE, FALSE} the > compiler could choose char and only allocate a byte. But > for enum x {y = 1<<22}, the compiler must choose a type > large enough to hold 1<<22, unless 1<<22 is not a value > that can be represented by the type int. > " > > At your suggestion, with sustaining votes from our group, the change > will be in the DEC C compiler in Digital UNIX V5.0. > > Thanks for your comments on DEC C. Thanks Jeff, and thanks also to your project leader. I appreciate the time and effort you've invested on these issues. Tim -- Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu Information Technology Services (701) 231-1076 (Voice) Room 242-J1, IACC Building (701) 231-8541 (Fax) North Dakota State University, Fargo, ND 58105-5164