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: Jeff Sullivan Subject: Re: [Help]gcc ignored #pragma pack on DEC/OSF1 4.0B Date: 1998/01/13 Message-ID: <34BBE9F2.5BC239F@zk3.dec.com>#1/1 X-Deja-AN: 315669504 Content-Transfer-Encoding: 7bit References: <689ng7$ja2@news.seed.net.tw> <34A918FF.EE41F28F@zk3.dec.com> <6c1zytk51r.fsf@dextrose.atria.com> <34B112CE.6F59@zk3.dec.com> <68shad$195@dogbert.cc.ndsu.NoDak.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Digital Equipment Corporation Newsgroups: comp.unix.osf.osf1,mooney@dogbert.cc.ndsu.NoDak.edu Tim Mooney wrote: > > While we're talking about the compiler... :-) > > 1) it warns about `__inline', and stdio.h uses `__inline', so one gets > screenfulls of warnings for any file that includes stdio.h. Is there a > #pragma to turn off particular warnings (or even warning altogether)? 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. See http://www.unix.digital.com/ and http://www.unix.digital.com/new/topten.html for more info on Digital UNIX V4.0D. > 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 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. -Jeff -- Jeff Sullivan | Digital Equipment Corp | sullivan@decc.enet.dec.com DEC C and C++ | Nashua, NH ZK3-2/2X09 | or jps@zk3.dec.com