Re: "Small C++" Anyone?
JohnQ wrote:
:: "Bo Persson" <bop@gmb.dk> wrote in message
:: news:56t3hqF284vrrU1@mid.individual.net...
::: JohnQ wrote:
::::: "Dennis (Icarus)" <nojunkmail@ever.invalid> wrote in message
::::::
:::::: Well, programming itself is "hard".
:::::
::::: Well it doesn't have to be. I mean, that would be a goal of "Small
::::: C++": programming doesn't have to be so hard. From the get go, if
::::: the new programmer could rely on an 8-bit byte and integer types
::::: of specific widths exclusively, just that would help propel
::::: someone to productivity with a language faster. type.h is
::::: probably where I'd start if I was to start laying out "Small
::::: C++": a standard set of integer types of guaranteed width and no
::::: nebulous integer types (no "is 32 bits on a 32 bit machine, 64
::::: bits on a 64 bit machine" etc.).
:::
::: Why is having a certain number of bits in an integer so good?
::
:: Inter-application communication. Portable data storage.
You get that by specifying the communications protocol, and the data storage
format.
Not by forcing everyone else to use you favorite format.
::
::: If you use it as a counter for number of objects (like characters),
::: isn't it EXTREMELY good that it is 16 bits on 16-bit hardware, 32
::: bits on 32-bit hardware, 36 bits on 36-bit hardware, and 64 bits on
::: 64-bit hardware?
::
:: No, not extremely. It's pretty trivial if you ask me.
::
:::
::: Not too big, not too small, but just right!
:::
:::
::: Just consider if we were to specify 9-bit bytes, 36-bit ints, and
::: 72-bit floating point for everyone, just because some machines look
::: like that.
::
:: I like 8-bit bytes and guaranteed-width integers. So does the
:: internet.
But that's at the network interface layer. The 9-bit machine will have to
convert to and from the proper protocol. Not a problem, as network transport
is much slower anyway.
But when I do some computations on my 36-bit machine, I want to be ALLOWED
to use 36-bit ints and 72-bit doubles. If the language says that it MUST
ALWAYS be 32-bit and 64-bit, I'm toast.
With Java, that is the case. With C++, it is not. I see that as a advantage!
Bo Persson