473,805 Members | 2,034 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
CTips wrote:
Thats another problem with Ada's run-time checking. If you're using it
in an environment where the hardware may "fail" [e.g. alpha particles
randomizing memory], the checks are quite often in the wrong place.


That's what CBIT is for.

Cheers

-- Martin
Jul 23 '05 #381
"Jerry Coffin" <jc*****@taeus. com> writes:
Adrien Plisson wrote:
Jerry Coffin wrote:
Second, if the work had been done exclusively or primarily in
a language the DoD considered its own, I suspect opening it up
to the public would have taken even longer, if it was ever
allowed to happen at all.


but still ARPA-net was created by the United States Defense Advanced
Research Project Agency, part of... the DoD !


That was exactly my point: it started out as a DoD-funded project. The
question is about what happened then -- how willing the DoD was to open
the project to the public at large. As it was, the project was done
with DoD funding, but was really done at and by universities. While it
is openly acknowledged to have fulfilled its original intent extremely
well, nearly every choice in its design and implementation was about as
UN-military as possible. Despite this, it took 20+ years before it was
really open to the general public.

Had even ONE element in the design or implementation fit even slightly
more closely with the military mind-set, I doubt it would have been
opened up to the public yet, or possibly ever.


Sorry, I don't know how to say it politely, but this argument (on both
sides) is patently ridiculous. For one thing, neither C++ nor Ada 95
existed at the time the Arpanet was created. For another thing, Ada has
never been "a language the DoD considered its own" -- the design has
always been entirely open. For goodness sakes, they even chose a
foreigner (Jean Ichbiah, who is French) to do the original 1983 language
design!

- Bob
Jul 23 '05 #382
In article <wc************ *@shell01.TheWo rld.com>, Robert A Duff <bo*****@shell0 1.TheWorld.com> writes:
Ki*******@SpamC op.net (Larry Kilgallen) writes:
Even Bliss has nested functions. What Ada has that Pascal has in addition
to nested functions is uplevel addressing, allowing an inner function to
access data declared in outer scopes.


Heh? Pascal has that.


Yes, I just said Pascal had that.
Jul 23 '05 #383
"fabio de francesco" <fm**@tiscali.i t> writes:
B.Stroustrup wrote in his "C++ Programming Language" that He was partly
inspired by Ada (and by a misterious to me "Clu") in creating C++
templates and exceptions. Does it mean these languages are closer than
everyone would expect?


Yes, these languages (C++ and Ada) are quite similar in many ways, and
both borrowed something from each other. To a programmer familiar with
Common Lisp or ML or many others, the arguments in this endless thread
must seem pretty silly. Kind of like arguing whether McDonald's or
Burger King is the better restaurant, not knowing about any others. On
the other hand, *those* languages also have serious flaws, too.

Clu is definitely worth learning.

- Bob
Jul 23 '05 #384
Turamnvia Suouriviaskimat ta wrote:
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.
Turamnvia, use what you like. A good compiler, good library set is only
as good as the programmer that uses it.

C is fast, small very flexible and somewhat dangerous. The MISRA subset
of C produce better mission critical code, because the richness of the
language is restricted/disallowed.

C++ is an object oriented extension to C. It is an improvement on C, but
IMHO not well suited to small embedded systems. However it depends on
your tools and your writing skills. (Java would be better than C++ for
embedded design, but try finding native compilers!)

ADA provides for concise system description right there within the
language. It works everytime, all the time. It is not prone to code
ambiguity like C and therefore C++, even though all code ambiguity is
the programmers fault.

Every mission critical system I developed or assisted on pre 2001 was
ADA and Occam based. After 2001 some of my employers have switched to
the use of C (adhering to the MISRA subset/controls.) Conversely, pre
and post 2001 every GUI, test tool, front-end, test engine and
instrumentation interface was written in C, C++, Java, Delphi and more
recently C# (quick and dirty).
I've many years of experience in C/C++ (and
Delphi) but no Ada knowledge.
Delphi grew from Turbo Pascal at Borland. ADA is Pascal with necessary
enhancements for mission critical (military) applications. btw VHDL grew
out of ADA.
May I ask if it is too difficult to move from C/C++ to Ada? You may ask. Answer: it depends on you. IMHO no, but I learned Pascal
before C, OOA/OOD before C++ and ADA after 'Z'. Simply put, the
languages are different, the concepts and methods are different. The
applications are not.
What is the best way of learning Ada for a C/C++ programmer?

Get some books you like. You want a hacker's guides to start with, free
stuff, online manuals, tutorials etc. Make notes and lots of code
snippets; lots and lots of code snippets.

This will get you up and running. Then the heavy stuff later on: set
yourself tasks, projects etc. Discover what tools and methods are
available to perform ADA design on your target system(s).

----------------
Lastly, avoid comparing the languages. Avoid conversations especially
with lecturers and users of more modern languages (c/c++, c# even
Delphi). It will just start arguments.

All programming languages have their niches and some are more suited to
a task than others. Most Aircraft use ADA; Banks use C++; Most
Instrumentation and embedded engineers use C/Assembler (ASM); Most Game
developers use ASM and more recently C; Communication systems requiring
formal definition use CSP & Occam. Schools teach Basic; Colleges teach
C, C#, vb.net or vb; Universities teach Pascal, C, C++, Occam, ADA and
more......

An introduction to cat skinning. (The Abridged War and Peace version)

Good luck and God Bless.
Jul 23 '05 #385
dave wrote:
C++ is an object oriented extension to C. It is an improvement on C, but
IMHO not well suited to small embedded systems. However it depends on
your tools and your writing skills. (Java would be better than C++ for
embedded design, but try finding native compilers!)

I can't understand why native Java would be better.

Lastly, avoid comparing the languages. Avoid conversations especially
with lecturers and users of more modern languages (c/c++, c# even
Delphi). It will just start arguments.

I agree completely with this.
Most Game developers use ASM and more recently C;
And more recently (years) C++. :-)

Communication systems requiring
formal definition use CSP & Occam. Schools teach Basic;

Actually I think they teach Pascal and perhaps some C. But it depends on
the countries I guess.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #386
CTips <ct***@bestweb. net> writes:
Umm ... look at the set of lock-free data-structures out there. Quite
heavy-weight structures can be implemented, including a queue where a
thread can be adding elements while other threads are removing elements.


Umm ... what does this have to do with the discussion, which was about
C++ vs. Ada, or perhaps C vs. Ada?

Of course you can write lock-free algorithms equally well in all the
languages in question. Of course all these languages allow machine-code
inserts, and of course you can't know from the language standard what
the compiler does with them. If you have evidence to the contrary,
let's hear it.

- Bob
Jul 23 '05 #387
REH

"CTips" <ct***@bestweb. net> wrote in message
news:11******** *****@corp.supe rnews.com...
REH wrote:
Thats another problem with Ada's run-time checking. If you're using it in
an environment where the hardware may "fail" [e.g. alpha particles
randomizing memory], the checks are quite often in the wrong place.

For example, look at the Ada equivalent of the following code.
typedef enum {0, 1, 2, 3} four_val;
four_val x;

x = (four_val) some_int;
....
assert( x < 4);

The compiler will drop in a check at the cast to ensure that the wrong
value is not getting stored into x. Then, it will proceed to eliminate the
check that x < 4, because it knows that 0..3 are the only legal values of
x. However, if there is a hardware bug, the value of x will get changed
between the definition point and the use point.

When bringing up hardware, I like to have a little more control over where
the run-time checks are going to be placed. This is another niche
situtation in which the compiler's "automatic" checking does the wrong
thing.


You continue to make illogical arguments in some misguide attempt to prove
you are somehow better than those who program in Ada. Next you are going to
complain because Ada can recover from your hardware catching fire. You are
just being ridiculous.

Jul 23 '05 #388
In article <49************ ****@linux1.kri schik.com>,
Martin Krischik <ma****@krischi k.com> wrote:
Jerry Coffin wrote:
Pascal Obry wrote:
"Jerry Coffin" <jc*****@taeus. com> writes:
> Your claim of fewer bugs is just the sort of unsupported anti-C
> comment we see all the time.

Just plain wrong, there is data (a PHD) see
http://www.adaic.com/whyada/ada-vs-c/cada_art.html
Perhaps you should reread this, paying paritcular attention to the
dates involved. According to the paper, they started switching from C
to Ada around 1986. C wasn't standardized until 1989, and (as you'd
expect) it was some time after that before most compilers implemented
the standard language.


Did they? Or did they just implemented some 80% of the new features? My
experience with C/C++ (and I have 10 years + of that) is that at no time
there was a fully compiant C compiler available. There where allways a lot
of compiler avaliable who claimed to be <small>almost </small> complinant -
but never one which realy was.


Many vendors have misspoken their situation. That aside,
I'm confused about the above. Are you saying that
from 10 years from 1989 you only came across 80% complaincy
of C compilers?
Partily because - unlike Ada (http://en.wikipedia.org/wiki/ISO_18009) -
there is not official testsuite to test a C/C++ compiler and runtime
library. Such an official testsuite would do C/C++ all sorts of good.


Partly, but on partly :)
--
Greg Comeau / Comeau for the Mac? Stay tuned.
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jul 23 '05 #389
In article <49************ ****@linux1.kri schik.com>,
Martin Krischik <ma****@krischi k.com> wrote:
Jerry Coffin wrote:
In short, this is not a comparison to the C language as it exists
today, or has existed in well over a decade.
What do you mean by "exists today"? C99 is 5 years old and still no compiler
is available which support all C99 features. "restrict" - missing in MS-C
(even thrue restrict can be implemented as "no operation") - VA - arrays
(savety critical feature) - missing in MS-C, buggy in GCC.


Comeau C (based on EDG) + Dinkumware has provided said for a
few years now. See http://www.peren.com/pages/cvsa_isocvpl.htm
The most compatible C/C++ compiler AFAIK is digital mars
(http://www.digitalmars.com) with "only" 4 C99 features missing:
(http://www.digitalmars.com/ctg/ctgLa...unimplemented).

But even digital mars aims only at the C++98 and not the current C++ 2003.
And there are still 4 features missing:
(http://www.digitalmars.com/ctg/ctgLa...unimplemented).


I think you've misread that URL. It does not say that.
It's a reasonable compiler, and has many pros, but it is
not to my knowledge the most compatible(?) C/C++ compiler.
If anything, based on my own experience with standard C vs.
pre-standard C, I'd say his study shows rather the opposite of what you
think it does. Standard C was enough of an improvement over
pre-standard C that it would be rather surprising if standard C didn't
beat Ada in most areas studied (the primary exception being code
reuse).


Maybe just maybe - if there realy was any standart compiler available - but
there isn't - the C/C++ compiler vendors are allways one release behind the
actual ISO standart.


Comeau C (to C90 and C99) and Comeau C++ (to C++98 and C++03)
along with Dinkumware gives you it all, tons of additional modes,
multiplatform, etc. For many years for each language.
By contrast, comparing modern C++ to the pre-standard C shows _large_
improvements in nearly all areas. This is due in part to the changes in
the language itself, but perhaps even more so to improved understanding
of how to use the language.


True - the former slim languages designed by individuals have become fad
languages desined by the ISO commitie ;-).

It is true that a programming language need some minimum features set to be
usefull. And that feature set is a lot larger then most belive. If a
successfull language does not provide that set it will be bolted on later.
If anything the current C/C++ ISO standards clearly show that the advocates
for slim languages hat been wrong all along.


There's room for each.
--
Greg Comeau / Comeau for the Mac? Stay tuned.
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jul 23 '05 #390

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
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...
0
10356
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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
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?
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.