[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ equivalent to spaghetti code

From: James Kanze
Subject: Re: C++ equivalent to spaghetti code
Date: Wed, 23 Jul 2008 00:42:29 -0700 (PDT)
User-agent: G2/1.0

On Jul 22, 7:21 pm, Ben Pfaff <> wrote:
> James Kanze <> writes:
> > C doesn't have any support for decimal arithmetic, nor any means
> > of adding it comfortably.


Yes, I'd heard about this.  But I wasn't too sure of its status,
and it isn't implemented by the compilers I regularly use.

IMHO, it is an important step forward.  Both decimal and complex
are really only used by a restricted community; one could argue
on those grounds that they don't belong in the standard of a
general purpose language.  On the other hand, those communities
really do need them, and not having them generally means that
the language can't be used for certain applications, at least
not effectively.

C++ sort of side steps the issue; because it has operator
overloading, you can (supposedly) write your own, or use a third
party library.  But your own or a third party library is still
not the same thing as "standard"; and in the case of decimal
arithmetic, there are also performance issues to consider: many
machines have direct hardward support for decimal arithmetic,
which a library written in C or C++ won't be able to access.
(Many years back, I was involved in porting some software using
BCD to different architectures.  The person who ported it to the
Siemens mainframe rewrote the four BCD arithmetic operators in
assembler: something like 40 lines of assember, with no loops,
to replace 400 lines of C, with several loops, and a speed up of
five magnitude.)

James Kanze (GABI Software)   
Conseils en informatique orientée objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

reply via email to

[Prev in Thread] Current Thread [Next in Thread]