473,805 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Teaching new tricks to an old dog (C++ -->Ada)

I 'm following various posting in "comp.lang. ada, comp.lang.c++ ,
comp.realtime, comp.software-eng" groups regarding selection of a
programming language of C, C++ or Ada for safety critical real-time
applications. The majority of expert/people recommend Ada for safety
critical real-time applications. I've many years of experience in C/C++ (and
Delphi) but no Ada knowledge.

May I ask if it is too difficult to move from C/C++ to Ada?
What is the best way of learning Ada for a C/C++ programmer?

Jul 23 '05
822 29860
In article <11************ *@corp.supernew s.com>, CTips <ct***@bestweb. net> writes:
On some implementations (on RISC architectures) a register is reserved
for the static-chain. This means one less register for *every* function
(or maybe only for enclosed functions?) when used with a language that
support this kind of nested functions.
It does not have much to do with whether one language supports it,
so long as _some_ language supports it.

If I have a call chain:

Ada => C => Ada

that second Ada subprogram might want to access a variable in the first
Ada subprogram. So the C implementation must pass the context along.
As I understand it, that is the job of the "Bound Procedure Value"
construct in the VMS Calling Standard. Such relationships between
languages must be defined by the calling standard for the platform,
meaning that the C compiler should honor it as well. I imagine that
HP Ada and HP Pascal interact properly in this regard -- I have no idea
about HP C.
C++ probably left it out because of its C heritage, while Ada probably
dropped it in because of its Pascal heritage. IMHO, its probably not
worth the cost.


If that is your opinion, I would say you have not done enough programing
in a language where it is provided.
Jul 23 '05 #471
On 14 Mar 2005 19:00:00 -0500, Robert A Duff
<bo*****@shell0 1.TheWorld.com> wrote:
But if you want to hide most of the data of some abstraction, and
there's no "natural" meaning of "<", then you have to think ahead, and
define some "<" operation just in case somebody wants to put the thing
into a container. (Or, of course, go back and add that in to an
existing data type when you find it's needed.)


Bertrand Meyer went pretty heavily into this situation with his
"open-closed" principle in Eiffel - largely why he's a big fan of multiple
inheritance. This in a sense follows your paranthetical remark.
Jul 23 '05 #472
Randy Brukardt wrote:

[ ... ]
This statement is false. I was going to try to explain precisely what
happened, but it probably is better to just point to the articles on that topic that were published at the time. See:
http://www.adaic.com/compilers/index.html
and in particular:
http://www.adaic.com/compilers/acaa.html


I see it, but I also see things like this:

----- quote -----
Q. What about NIST? Isn't Ada still a FIPS standard, with requirements
for NIST validation?

A. FIPS 119-1 is still valid, and section 11.4 states that
"Implementation s of FIPS Ada shall be validated in accordance with the
NIST Computer Systems Laboratory (CSL) validation procedures for FIPS
Ada". However, such validation procedures no longer exist, since NIST
had delegated Ada validation authority to AJPO, and AJPO did not
re-delegate this authority.
--- end quote ---

(from: http://sw-eng.falls-church.va.us/ajpofaq.html) which seems to
agree reasonably closely with what I said. Some of it appears to be
obsolete -- FIPS pub 119-1 is NOT valid anymore; it has been withdrawn.
That has little to do with events that happened years ago though.

I'd also note that the relationship between the ACAA and the ISO seems
to be rather one-sided -- while you emphasize your relationship with
the ISO rather heavily on your web site, the ISO seems to mention you
rather a bit less -- a search for "ACAA" on the ISO web site more or
less implies that they've never even heard of you.

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #473
"Jerry Coffin" <jc*****@taeus. com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Randy Brukardt wrote: .... I see it, but I also see things like this: <Misleading junk snipped>
.... (from: http://sw-eng.falls-church.va.us/ajpofaq.html) which seems to
agree reasonably closely with what I said.
Ah, yes, the imfamous "Ada is dead site". (It doesn't say that anymore, but
it once did.) That site was created by someone how posted all kinds of
misinformation; people seem to believe it because they registered the old
AJPO domain name. Of course, anyone can post anything on the net, and it can
be hard to tell what's accurate and what isn't.
I'd also note that the relationship between the ACAA and the ISO seems
to be rather one-sided -- while you emphasize your relationship with
the ISO rather heavily on your web site, the ISO seems to mention you
rather a bit less -- a search for "ACAA" on the ISO web site more or
less implies that they've never even heard of you.


Since the ACAA is defined in an ISO standard (specifically ISO/IEC 18009),
and ISO makes money by *selling* their standards, you're hardly going to
find anything there. I don't think you can find much about Ada there,
either. The ACAA I run is an instantiation of that described by that
standard.

You might be able to find out more on the WG9 web site (WG9 is the Ada
Working Group within ISO/IEC JTC1 SC22), but it is pretty sparse:
http://www.open-std.org/JTC1/SC22/WG9/

Randy.

Jul 23 '05 #474
On Tue, 15 Mar 2005 00:10:27 GMT, Dr. Adrian Wrigley wrote:
On Mon, 14 Mar 2005 23:46:33 +0000, Hyman Rosen wrote:
Dr. Adrian Wrigley wrote:
This means that you can't write an implementation of a template/generic
function using a map/hash without changing some/all the implementations
and interfaces up the instantiation tree (am I right?).


No, you are wrong. Simply write your comparison or hash function at the
point where you need it. Use the public accessors to get the data you
need to perform the operations.


That's the point... there aren't any public accessor functions
for opaque data types such as non-limited generic formal parameters.


Then the data are inherently non-sortable. That was designer's decision,
and that is *the* contract. To define "<" would mean to break that
contract.

There are lot of situations where some ad-hoc generated comparison will not
work. Especially if objects are in fact handles to something that may
change asynchronously to the container.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Jul 23 '05 #475
On 14 Mar 2005 16:02:43 -0500, Robert A Duff wrote:
"Dmitry A. Kazakov" <ma*****@dmit ry-kazakov.de> writes:
It can be formulated in two words: "contract model" is what C++ templates
lack.
Which is both a benefit and a drawback. C++ templates are somewhat more
powerful that Ada generics, because of the lack of contract model, and
implicit instantiation.


I think that the reason is not contracts but inflexible contracts. Ada
formal generic parameters are not ADTs. So there is no way to define a
formal generic type Ordered. Instead of that ADTs are defined ad-hoc:

generic
type Foo is private;
function "<" (Left, Right : Foo) return Boolean is <>;
package ...

What is worse is that these ad-hoc ADTs are not named, so in fact it is a
kind of that flawed structural type equivalence reborn.
But I don't think that addresses Dr. Wrigley's complaint (which applies
to both Ada and C++).


Indirectly it does, because what he wants is to get more that is in the
contract ... (:-))

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Jul 23 '05 #476
Greg Comeau a écrit :
Other posts seems to disagree. I don't see how they could disagree with the mere fact that Adalog is a
registered ACAL, but anyway...
Please clarify for us.
Also include how and why your company is the _official_ lab.
(I'm not challenging you, but seems to me a mixed message
is coming through this thread.)

The ACAA (see Randy's posts) is the official office for issuing
conformance certificates. These certificates are issued after
conformance testing has been performed by an ACAA approved laboratory,
called and ACAL. Adalog has been approved by ACAA, and this is easily
checked by going to the ACAA site!

People arguing that there is no more validation office are simply wrong,
and I hope it is misinformation and not malice.
--
---------------------------------------------------------
J-P. Rosen (ro***@adalog.f r)
Visit Adalog's web site at http://www.adalog.fr
Jul 23 '05 #477
Dmitry A. Kazakov wrote:
I think that the reason is not contracts but inflexible contracts. Ada
formal generic parameters are not ADTs. So there is no way to define a
formal generic type Ordered.


Hm. Do you mean, a contract type cannot be _defined_ in the
generic formal part of a unit?
Otherwise, why not just write

generic
type Ordered is new Has_Less_Than with private;
package ...

where Has_Less_Than is an abstract type with a "<" operation.

(Or use multiple interfaces and Ada 2005.)
Jul 23 '05 #478
Dr. Adrian Wrigley wrote:
That's the point... there aren't any public accessor
functions


It's a good point. If you design a library you not only have to decide
up front whether you want to let users put your class in ordered
containers but whether you want to allow containers at all (Generic
algorithms freely make copies of elements and assume value semantics).

I have to ask myself though: If I am denied access to information that
lets me implement a < operator, am I supposed to be able to sort it?

Groete
Hans

Jul 23 '05 #479
On Tue, 15 Mar 2005 11:51:33 +0100, Georg Bauhaus wrote:
Dmitry A. Kazakov wrote:
I think that the reason is not contracts but inflexible contracts. Ada
formal generic parameters are not ADTs. So there is no way to define a
formal generic type Ordered.


Hm. Do you mean, a contract type cannot be _defined_ in the
generic formal part of a unit?
Otherwise, why not just write

generic
type Ordered is new Has_Less_Than with private;
package ...

where Has_Less_Than is an abstract type with a "<" operation.


In which case it simple does not need to be generic! Ordered here is a
normal ADT, which class is Has_Less_Than'C lass. So the package should work
directly with the class and be non-generic. End of story.

What I meant was:

generic
type Ordered is Has_Less_Than; -- This is not Ada!
package ...

Here Has_Less_Than is not a type but a [generic] class of types, like
"private", "limited private", "range <>", etc. It is almost same but not
the same. This is actually why I strongly believe that generics are
superfluous and should be replaced by better ADTs (now normal ones, one
storey below). In other words there is no need to make a fuss with types
ADT (=classes of formal generic types) when we are far from being ready
with the normal ones!

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Jul 23 '05 #480

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
2366
by: Mediocre Person | last post by:
Well, after years of teaching grade 12 students c++, I've decided to make a switch to Python. Why? * interactive mode for learning * less fussing with edit - compile - link - run - debug - edit - compile - link - run -..... * lots of modules * I was getting tired of teaching c++! Bored teacher = bad instruction.
14
1828
by: Gabriel Zachmann | last post by:
This post is not strictly Python-specific, still I would like to learn other university teachers' opinion. Currently, I'm teaching "introduction to OO programming" at the undergrad level. My syllabus this semester consists of a bit of Python (as an example of a scripting language) and C++ (as an example of a compiled language). With C++, I go all the way up to meta-programming. My question now is: do you think I should switch over to...
3
1538
by: andy_irl | last post by:
Hi there I have been asked to teach HTML to a group in our local village community. It is nothing too serious, just a community development grant aided scheme. It will be a 10 week course of two hours per week and will mainly consist of mature students. I may or may not include GUI's depending if I can fit it all in to the time allocated. I was wondering if anyone could point me to any useful teaching resources for HTML on the web ie...
12
2004
by: Pierre Senellart | last post by:
I am going to teach a basic Web design course (fundamentals of HTML/CSS, plus some basic client-side (JavaScript) and server-side (PHP, perhaps XSLT) scripting). Most of the students do not have any previous knowledge of all of this. I am strongly considering teaching XHTML 1.0 Strict instead of HTML 4.01 strict, for the following reasons: - XML syntax is far more simple to teach than HTML/SGML, simply because there are not as many...
16
4379
by: msnews.microsoft.com | last post by:
I am teaching C# to my 11 year old child. One challenge is that all the C# books I own and that I have seen in bookstores are full of language that is not easily comprehended by a student at that age. Can anyone recommend books (or perhaps websites) tuned for younger audiences? BTW, its amazing how fast a student can absorb this kind of information at that age. Lucky them! Thanks, Bruce
24
2867
by: Richard Aubin | last post by:
I'm really new to vb.net programming and programming in general. I would like to teach myself on how to program effectively and I have the financial and time resources to do so. Can I anyone recommend and point me in the right direction where I should start? -- Richard Aubin
0
1720
by: e.expelliarmus | last post by:
check this out buddies. kool website for: * hacking and anti hacking tricks * anti hackng tricks. * registry tweaks * orkut tricks * small virus * computer tricks and loads of different tricks... www.realm-of-tricks.blogspot.com www.registrydecoded.blogspot.com
1
3897
by: JosAH | last post by:
Greetings, Introduction This week's tip describes a few old tricks that are almost forgotten by most people around here. Sometimes there's no need for these tricks anymore because processors nowadays are so fast and memory comes in abundance. But still, if we implement an algorithm that is better, or more efficient, than another one, those faster processors run the first algorithm faster than the other one. If an algorithm takes less...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10361
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7644
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.