From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f849b,b8d52151b7b306d2 X-Google-Attributes: gidf849b,public X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-30 02:22:13 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.arch.embedded,comp.lang.ada Subject: Re: Certified C compilers for safety-critical embedded systems Followup-To: comp.arch.embedded,comp.lang.ada Date: Tue, 30 Dec 2003 11:18:55 +0100 Organization: AdaCL Message-ID: <1086072.fFeiH4ICbz@linux1.krischik.com> References: <3fe00b82.90228601@News.CIS.DFN.DE> <3FE026A8.3CD6A3A@yahoo.com> <3bf1uvg2ntadvahfud2rg6ujk24sora6gr@4ax.com> <2u3auvogde8ktotlaq0ldiaska3g416gus@4ax.com> <20619edc.0312221020.3fd1b4ee@posting.google.com> <20619edc.0312222106.3b369547@posting.google.com> <45cs9hAbLc6$EAAx@phaedsys.demon.co.uk> <3fe9f0d7.104475725@News.CIS.DFN.DE> <5802069.JsgInS3tXa@linux1.krischik.com> <1072464162.325936@master.nyc.kbcfp.com> <1563361.SfB03k3vvC@linux1.krischik.com> <11LvOkBBXw7$EAJw@phaedsys.demon.co.uk> <3ff0687f.528387944@News.CIS.DFN.DE> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1072779552 07 17885 lHZvGHqvtpTrSIg0 031230 10:19:12 X-Complaints-To: usenet-abuse@t-online.de X-ID: Zj+7uOZVweBgrye5ixTOG0FCY+wj4RLpZo3zc0anqqhxpcYvEwDlEw User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.arch.embedded:6331 comp.lang.ada:3946 Date: 2003-12-30T11:18:55+01:00 List-Id: Dave Hansen wrote: > On Sun, 28 Dec 2003 16:33:05 +0000, Chris Hills > wrote: > > [...] >> >>[plain] char is a character >>singed and unsigned char are integer types. > > Plain character is an abomination. It is particularly unsuited for > character data. You can get singed. ;-) Grin. But most C programmers are to lazy for to type unsigned. > All three are integer types. All three are 1 byte wide ("byte" does > not mean "8 bits"). That is why Ada 'Size gives you the size in bits. No misunderstanding here. >>>If you are lucky you have real C99 compiler with byte. > > I'm not sure what you mean. There's no such thing as "byte." > uint8_t? Not guaranteed to exist. unint_least8_t? That would work, > but I fear relatively few even know it exists, let alone how to use > it... You allwas learn something new. But unint_least8_t is not helpfull for safety-critical embedded systems. You might need exaclty 8 bit. Which brings me back to the original Question. How will you do this in C: type Month is new Integer range 1 .. 12; for Month'Size is 8; Or even better: type Display_Element is Interger range 0 .. 9; for Display_Element'Size use 4; type Display_Array is array (Integer range 1 .. 6) of Display_Element; pragma Pack (Display_Array); Display : Display_Array; for Display'Address use 16#12_3456#; We are talking "safety-critical embedded systems". The Plane might crash if 11 is ever stored in a Display_Element. With Regards Martin. -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com