comp.lang.ada
 help / color / mirror / Atom feed
From: Jean-Marc Bourguet <bourguet@my-deja.com>
Subject: Re: C/C++ programmer giving Ada95 a chance -- writing an emulator.
Date: 2000/03/28
Date: 2000-03-28T00:00:00+00:00	[thread overview]
Message-ID: <8bpqga$8sh$1@nnrp1.deja.com> (raw)
In-Reply-To: 38E05DF5.D9AEC67A@research.canon.com.au

In article <38E05DF5.D9AEC67A@research.canon.com.au>,
Geoff Bull <geoff@research.canon.com.au> wrote:
>
> jross wrote:
> >
> > C/C++ is prime for such a low level application. How about Ada?
>
> Anything you can write in C you can more or less directly translate
> to Ada.

But I'd warn against trying to put a C++ design in Ada. Success would
perhaps proove something -- but I do not know what -- failure surely
nothing more that Ada is not a better syntax for C++. You'll have
problem with features not present in Ada, and never think about
using features not present in C++ (in you exemple, do you have though
about using taks to for the different parts of the processor and the
peripherals? I'd do this more rapidly in Ada than using threads in C++)

> > My first question is how do you define and write a dispatching
> > mechanism as you would in C++ using function pointers in a table for
> > execution speed efficiency, like this:
> >
>
> The following is a direct translation of your code:

No, it isn't. For one, the original C++ made use of pointers to member
functions. Having little used of access to procedures, I do not know if
the equivalent is possible -- calling throw the access would need to
trigger a dispatching call (James, this term has a technical meaning
in Ada); I think a wrapper procedure would be needed to achieve the
equivalent (I'm supposing that the TCpu class not showed declare the
Op_xx as virtual functions).

In either case, I know too little about your design (what is the TCpu
class for) and your design goals (what where you trying to achieve
by introducing it) to give a good translation of your code. The correct
equivalent of a class in C++ may be a package or a non tagged type or a
tagged type. Even for TACpu I can not tell which one is better.

-- Jean-Marc


Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~2000-03-28  0:00 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <38e148e2.5089627@news.shreve.net>
2000-03-28  0:00 ` C/C++ programmer giving Ada95 a chance -- writing an emulator Ken Garlington
2000-03-28  0:00 ` Juergen Pfeifer
2000-03-28  0:00   ` Jim Rogers
2000-03-29  0:00     ` Ed Falis
2000-03-29  0:00       ` James S. Rogers
2000-03-29  0:00         ` Jean-Marc Bourguet
2000-03-29  0:00         ` Robert Dewar
2000-03-30  0:00         ` Geoff Bull
2000-03-30  0:00           ` tmoran
2000-04-01  0:00           ` Robert Dewar
2000-03-28  0:00 ` Geoff Bull
2000-03-28  0:00   ` Jean-Marc Bourguet [this message]
     [not found] ` <38e19656.17008608@news.shreve.net>
2000-03-29  0:00   ` Marin D. Condic
2000-03-29  0:00   ` swhalen
2000-03-29  0:00     ` Robert Dewar
2000-03-30  0:00       ` swhalen
2000-03-29  0:00   ` Marc A. Criley
2000-03-29  0:00   ` David Starner
2000-03-29  0:00     ` Robert Dewar
2000-03-29  0:00       ` Jean-Marc Bourguet
2000-03-29  0:00         ` Robert Dewar
2000-03-30  0:00           ` Jean-Marc Bourguet
2000-04-01  0:00             ` Robert Dewar
2000-03-29  0:00       ` Marin D. Condic
2000-03-29  0:00         ` Robert A Duff
2000-03-29  0:00           ` Marin D. Condic
2000-03-30  0:00       ` Geoff Bull
2000-04-01  0:00         ` Robert Dewar
2000-04-02  0:00           ` Geoff Bull
2000-04-02  0:00             ` swhalen
2000-04-02  0:00             ` Robert Dewar
2000-03-29  0:00     ` Robert A Duff
2000-03-30  0:00       ` Geoff Bull
2000-04-01  0:00         ` Robert Dewar
2000-03-30  0:00   ` Ken Garlington
2000-03-30  0:00   ` Samuel T. Harris
2000-04-01  0:00     ` Robert Dewar
2000-04-05  0:00       ` Robert A Duff
2000-03-30  0:00 ` Geoff Bull
     [not found]   ` <38e7e951.8384503@news.shreve.net>
2000-04-02  0:00     ` Jean-Pierre Rosen
2000-04-02  0:00       ` Robert Dewar
2000-04-03  0:00         ` Paul Graham
2000-04-06  0:00           ` Robert Dewar
2000-04-06  0:00             ` Larry Kilgallen
2000-04-06  0:00               ` Robert Dewar
2000-04-06  0:00                 ` Gautier
2000-04-07  0:00                   ` Robert Dewar
2000-04-07  0:00                     ` Gautier
     [not found] <38E3DBD7.27F5B246@acenet.com.au>
2000-03-31  0:00 ` tmoran
2000-03-31  0:00   ` Geoff Bull
2000-04-01  0:00     ` Tucker Taft
2000-04-02  0:00       ` Robert Dewar
2000-04-02  0:00         ` Geoff Bull
2000-04-02  0:00       ` Geoff Bull
replies disabled

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