comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Ada Smileys in C++ lib Conversion
Date: Tue, 17 Aug 2010 06:37:42 -0700 (PDT)
Date: 2010-08-17T06:37:42-07:00	[thread overview]
Message-ID: <1b64e5c2-f3d5-41e9-99cb-70e92c074d33@q22g2000yqm.googlegroups.com> (raw)
In-Reply-To: Xns9DD75B13CC31FWarrensBlatherings@188.40.43.230

On 17 Sie, 14:57, Warren <ve3...@gmail.com> 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



  reply	other threads:[~2010-08-17 13:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13 14:20 Ada Smileys in C++ lib Conversion Warren
2010-08-13 15:06 ` Yannick Duchêne (Hibou57)
2010-08-13 16:53 ` Anh Vo
2010-08-14  1:36   ` Warren
2010-08-14  9:52     ` Georg Bauhaus
2010-08-14 10:57     ` Brian Drummond
2010-08-14 20:34       ` Maciej Sobczak
2010-08-14 21:01         ` Dmitry A. Kazakov
2010-08-15  1:16         ` Brian Drummond
2010-08-15 10:04           ` Maciej Sobczak
2010-08-16 12:08             ` Brian Drummond
2010-08-16 12:13               ` Georg Bauhaus
2010-08-16 12:30             ` Brian Drummond
2010-08-16 12:39               ` Maciej Sobczak
2010-08-16 21:39                 ` Brian Drummond
2010-08-16 22:53                   ` Robert A Duff
2010-08-24 10:12           ` David Thompson
2010-08-30  9:51             ` Brian Drummond
2010-08-16 14:54       ` Warren
2010-08-16 20:27         ` Maciej Sobczak
2010-08-17 12:57           ` Warren
2010-08-17 13:37             ` Maciej Sobczak [this message]
2010-08-17 15:07               ` Georg Bauhaus
2010-08-18 17:31               ` Warren
2010-08-24 10:12             ` David Thompson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox