comp.lang.ada
 help / color / mirror / Atom feed
From: David Thompson <dave.thompson2@verizon.net>
Subject: Re: Factory Pattern
Date: Sun, 26 Aug 2007 07:18:07 GMT
Date: 2007-08-26T07:18:07+00:00	[thread overview]
Message-ID: <1l10c39bd7ghcvk8lij3hvr0lhevc2mahp@4ax.com> (raw)
In-Reply-To: 1185540454.137500.28610@b79g2000hse.googlegroups.com

On Fri, 27 Jul 2007 05:47:34 -0700, Maciej Sobczak
<see.my.homepage@gmail.com> wrote:

> On 27 Lip, 12:16, "Jeffrey R. Carter"
> <spam.jrcarter....@acm.nospam.org> wrote:
> 
> > > No. C and C++ have enumerations.
> >
> > Which are just names for integer values, last time I looked.
> 
> No. There are implicit conversions to int, but enums are separate
> types.
> 
> > The type of
> > a function parameter would be int.
> 
> No. Each enum is a separate type:
> 
<snip rest>

Actually this is an area of difference between C and C++, and as such
called out in Annex C of the C++ standard.

In C enum values are just 'int' values, and enum types are just
aliases for integer types -- commonly just one integer type, 'int',
although the C standard did and does allow each enum type to be any
integer type that covers the specified range. You can directly assign
(or pass or return) to an enum from an integer or different enum type.
In C++, each enum type is a distinct type, and its values are of its
type; as you go on to detail, they can disambiguate overloads, and
also an enum can be silently converted to integer (int or possibly
long, since C++ unlike C allows enum values outside the range of int),
but not to another enum or from integer to enum without a cast or in
some (stronger) contexts a user-defined conversion operator.

- formerly david.thompson1 || achar(64) || worldnet.att.net



      reply	other threads:[~2007-08-26  7:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 18:19 Factory Pattern shaunpatterson
2007-07-25 18:28 ` Martin
2007-07-25 18:51 ` Dmitry A. Kazakov
2007-07-25 21:06   ` Georg Bauhaus
2007-07-25 19:27 ` Matthew Heaney
2007-07-26  0:51 ` Jeffrey R. Carter
2007-07-26  6:44   ` Maciej Sobczak
2007-07-26  8:40     ` Georg Bauhaus
2007-07-26  9:53       ` Dmitry A. Kazakov
2007-07-26 11:01         ` Georg Bauhaus
2007-07-26 13:02           ` Maciej Sobczak
2007-07-26 13:44             ` Dmitry A. Kazakov
2007-07-26 14:58             ` Georg Bauhaus
2007-07-26 22:31             ` Randy Brukardt
2007-07-27 13:07               ` Maciej Sobczak
2007-07-27 14:23                 ` shaunpatterson
2007-07-27 22:23                 ` Randy Brukardt
2007-07-28 18:56                   ` Maciej Sobczak
2007-07-29  7:54                   ` Maciej Sobczak
2007-07-29  8:53                     ` Dmitry A. Kazakov
2007-07-29 10:53                     ` Georg Bauhaus
2007-07-26 16:58         ` Adam Beneschan
2007-07-29 11:38         ` Manuel Gomez
2007-07-27 10:16     ` Jeffrey R. Carter
2007-07-27 12:47       ` Maciej Sobczak
2007-08-26  7:18         ` David Thompson [this message]
replies disabled

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