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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a6fe9ef21ba269dc X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!q22g2000yqm.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada Smileys in C++ lib Conversion Date: Tue, 17 Aug 2010 06:37:42 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1b64e5c2-f3d5-41e9-99cb-70e92c074d33@q22g2000yqm.googlegroups.com> References: <1a9b39b0-73f6-497c-a8f4-abf8129886ac@t20g2000yqa.googlegroups.com> <9b88e5a4-c588-4997-ad5c-2efa216fe4f4@a4g2000prm.googlegroups.com> <95tc66hjv3stdk0nhdv9o46e5l2ecdog5j@4ax.com> NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1282052263 23079 127.0.0.1 (17 Aug 2010 13:37:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 17 Aug 2010 13:37:43 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q22g2000yqm.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13455 Date: 2010-08-17T06:37:42-07:00 List-Id: On 17 Sie, 14:57, Warren wrote: > > No. Enums are separate types. > > They are considered different "types" but (in C at least), > they're implemented as ints. IOW, you can't mix the enums > but you can supply an enum in an int argument. This is called "implicit conversion" and has nothing to do with how enums are implemented. I agree, however, that implicit conversions cause problems. > >> Further, the switch statement doesn't tell you about the > >> cases which are missing. > > > Try g++ -Wswitch. > > GCC extension. No, it is not an extension. It is a compiler option. The language standard does not define what options the compiler should support, so it does not make much sense to declare that some option is an extension. All options are features of respective products and products compete by offering different sets of features. For example, GNAT can check some code formatting rules. This is a feature of the compiler, not a language extension. > Try it on HP or AIX C compiler. And your point is? It is true that the language standard does not mandate such coverage check (unlike in Ada), but that does not make such analysis unfeasible or forbidden. Coming back to enums - they can help in such analysis and that's one of the reasons to use them instead of ints. -- Maciej Sobczak * http://www.inspirel.com