# Re: C++ Workshop Announcement from the NYLUG and NYLXS Mailing Lists

Discussion in 'C++' started by Kirit Sælensminde, Feb 11, 2010.

1. ### Kirit SælensmindeGuest

On Feb 2, 11:07 pm, Ruben Safir <> wrote:
> Integer data types can be defined as extended types with different sizes
> as follows:
>
> short int:                                       -32,768 - 32768
> unsigned short int:                                    0 - 65535
> int                               -2,147,483.648 - 2,147,483,648
> unsigned int                                   0 - 4,294,967,295
> long int                          -2,147,483.648 - 2,147,483,648
> unsigned long int                              0 - 4,294,967,295
>
> These numbers are byte sizes (65535 is the largest number representable
> in 4 bytes).

Are you in the process of learning this stuff yourself, or is this a
rough draft you expect us to help you to correct? Knowing how many
bits are in things like a byte and how binary numbers are represents
in computers is pretty basic programming knowledge. Are those numbers
really the ones that are given in the book? From inspection and
without working out what 2^31 or 2^32 actually is I can see that the
signed ranges are all wrong for 16 and 32 bits.

65535 is the largest number representable in 2 bytes (16 bits, and
65535 is 2^16-1 so 16 bit number can store from 0 to 65535 which is
65536 numbers which 2^16) using an unsigned integral type. Which of
the unsigned integer types is 2 bytes is implementation defined, and
in fact there is no requirement that one even be present.

> Computers has a special chip to work with factional numbers in decimal
> notation (not an easy piece of engineering IMO)

Presumably you mean binary notation here? And not all computers have
an FPU. Floating numbers and fractional numbers aren't really the same
thing at all either.

> float                1.17 x 10^-39 - 3.40x10^38 and 6 digit precision
> double               2.22 x10^-308 - 1.19x10^308 and 15 digit precision
> long double          very hardware specific
>
> As I understand it, the numbers are actually stored in scientific
> notation

You should probably actually know and understand this if you plan on
teaching it.

> C++ adds one additional data type calls a Boolean type to store true or
> false.  In C (and in C++), processes that need to test for a true or
> false view 0 as false and anything else as true.  But there are issues
> with that.  int's are 4 bytes and signed, chars can actually be singed
> and unsigned as well....so C++ adds
>
> bool              true or false
>
> which is really like some kind of enum operator (which hasn't been
> introduced).

Ummm.... no comment

I've not read the rest of it, but if this part is any guide it looks
like it still needs a lot of work to get it into any sort of shape
where it will be a good resource for other people to learn from.

As it stands I'm sure you will learn a lot in getting this stuff
correct and to a standard where other people can make use of it.

K

Kirit Sælensminde, Feb 11, 2010

2. ### Michael DoubezGuest

On 11 fév, 17:30, Ruben Safir <> wrote:
> On Thu, 11 Feb 2010 01:22:22 -0800, Kirit Sælensminde wrote:
> > Are you in the process of learning this stuff yourself, or is this a
> > rough draft you expect us to help you to correct? Knowing how many bits
> > are in things like a byte and how binary numbers are represents in
> > computers is pretty basic programming knowledge.

>
> Not for beginners.  For beginners it is a complete mystery, especially in
>
> > Are those numbers
> > really the ones that are given in the book? From inspection and without
> > working out what 2^31 or 2^32 actually is I can see that the signed
> > ranges are all wrong for 16 and 32 bits.

>
> That is from King, C Programming: A Modern Approach ISBN 0393969452
> page 111, one of about 8 resources I'm using.

From which source did you get ?
<quote - your post 08 Feb 2010>
C++ has added a new programming directive called the "using" directive
which is used to create namespace.[..]
</quote>

--
Michael

Michael Doubez, Feb 11, 2010

3. ### Michael DoubezGuest

On 11 fév, 21:42, Ruben Safir <> wrote:
> On Thu, 11 Feb 2010 08:44:39 -0800, Michael Doubez wrote:
> > On 11 fév, 17:30, Ruben Safir <> wrote:
> >> On Thu, 11 Feb 2010 01:22:22 -0800, Kirit Sælensminde wrote:
> >> > Are you in the process of learning this stuff yourself, or is this a
> >> > rough draft you expect us to help you to correct? Knowing how many
> >> > bits are in things like a byte and how binary numbers are represents
> >> > in computers is pretty basic programming knowledge.

>
> >> Not for beginners.  For beginners it is a complete mystery, especially
> >> in adult education.

>
> >> > Are those numbers
> >> > really the ones that are given in the book? From inspection and
> >> > without working out what 2^31 or 2^32 actually is I can see that the
> >> > signed ranges are all wrong for 16 and 32 bits.

>
> >> That is from King, C Programming: A Modern Approach ISBN 0393969452
> >> page 111, one of about 8 resources I'm using.

>
> > From which source did you get ?
> > <quote - your post 08 Feb 2010>
> > C++ has added a new programming directive called the "using" directive
> > which is used to create namespace.[..] </quote>

>
> Lippman, Lajoie: C++ Primer 437-440 ISBN 0201824701

I see where the mistake comes from, an unfortunate wording I guess.
IIRC Lippman says that a using directive *open* the namespace (in the
same meaning as "open a can", I guess).

In your wording, it is even worse. The using directive doesn't create
anything; it makes names visible in the scope.

> Would you like a complete bibiography?  I was thinking of writing one up
> anyway.

Not really. The important part is not in the book.

--
Michael

Michael Doubez, Feb 11, 2010
4. ### Michael DoubezGuest

On 12 fév, 01:00, Ruben Safir <> wrote:
> On Thu, 11 Feb 2010 14:40:57 -0800, Michael Doubez wrote:
> > On 11 fév, 21:42, Ruben Safir <> wrote:
> >> On Thu, 11 Feb 2010 08:44:39 -0800, Michael Doubez wrote:
> >> > On 11 fév, 17:30, Ruben Safir <> wrote:
> >> >> On Thu, 11 Feb 2010 01:22:22 -0800, Kirit Sælensminde wrote:
> >> >> > Are you in the process of learning this stuff yourself, or is this
> >> >> > a rough draft you expect us to help you to correct? Knowing how
> >> >> > many bits are in things like a byte and how binary numbers are
> >> >> > represents in computers is pretty basic programming knowledge.

>
> >> >> Not for beginners.  For beginners it is a complete mystery,
> >> >> especially in adult education.

>
> >> >> > Are those numbers
> >> >> > really the ones that are given in the book? From inspection and
> >> >> > without working out what 2^31 or 2^32 actually is I can see that
> >> >> > the signed ranges are all wrong for 16 and 32 bits.

>
> >> >> That is from King, C Programming: A Modern Approach ISBN 0393969452
> >> >> page 111, one of about 8 resources I'm using.

>
> >> > From which source did you get ?
> >> > <quote - your post 08 Feb 2010>
> >> > C++ has added a new programming directive called the "using"
> >> > directive which is used to create namespace.[..] </quote>

>
> >> Lippman, Lajoie: C++ Primer 437-440 ISBN 0201824701

>
> > I see where the mistake comes from, an unfortunate wording I guess. IIRC
> > Lippman says that a using directive *open* the namespace (in the same
> > meaning as "open a can", I guess).

>
> > In your wording, it is even worse. The using directive doesn't create
> > anything; it makes names visible in the scope.

>
> >> Would you like a complete bibiography?  I was thinking of writing one
> >> up anyway.

>
> > Not really. The important part is not in the book.

>
> Perhaps, but if the term directive is what is bothering you specifically
> with regard to "using", the text says specifically,

What bothers me is "create namespace". 'using' doesn't *create*
namespace.

In all cases 'using' only add/resolve name for unqualified lookup in
the enclosing scope (file, namespace, class, block ...).

> [snip: quote from Lippman]
> So "using", according to Lippman, is a directive.  Further, it is listed
> in the index as such.

Both exists (and are listed in the standard):
- the using declaration (§7.3.3): introduce a name (it is a
declaration)
- the using directive (§7.3.4): add a namespace content in current
scope (like an include but for namespace)

--
Michael

Michael Doubez, Feb 12, 2010
5. ### red floydGuest

On Feb 12, 1:20 pm, Ruben Safir <> wrote:

> Oh that is good.  Do you have a URL for the whole standard?  I was
> reviewing scope before writing it up and I got hung up on the
> relationship with namespace and scope in C++, which prior to writing
> this, is something I thought I understood quite well.  A look at the
> standard would be very helpful.
>

The Standard is not freely available, it must be purchased. You can
find some of the pre-standardization drafts online.

See FAQ 6.13

http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.13

red floyd, Feb 13, 2010
6. ### red floydGuest

On Feb 12, 1:20 pm, Ruben Safir <> wrote:

> Oh that is good.  Do you have a URL for the whole standard?  I was
> reviewing scope before writing it up and I got hung up on the
> relationship with namespace and scope in C++, which prior to writing
> this, is something I thought I understood quite well.  A look at the
> standard would be very helpful.
>

The Standard is not freely available, it must be purchased. You can
find some of the pre-standardization drafts online.

See FAQ 6.13

http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.13

red floyd, Feb 13, 2010