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 29800
Dr. Adrian Wrigley wrote: the problem as I suggested in my previous post is that you have to pass in the comparison operator or hash function down the tree of template/generic instantiation, (composing them along the way) if you want to use maps/hashes.
In the standard library containers and algorithms case you do not pass
any function to the container. operator< is implicitly used.
--
Ioannis Vranos http://www23.brinkster.com/noicys
On Mon, 14 Mar 2005 20:43:08 +0200, Ioannis Vranos wrote: Dr. Adrian Wrigley wrote:
the problem as I suggested in my previous post is that you have to pass in the comparison operator or hash function down the tree of template/generic instantiation, (composing them along the way) if you want to use maps/hashes.
In the standard library containers and algorithms case you do not pass any function to the container. operator< is implicitly used.
The comparison operator here seems to be a generic formal function
parameter with a default value. This must be available at instantiation.
The operator becomes part of the interface (implicitly or explicitly) for
any code instantiating the std::map. Where does the code for the
comparison operator go? It *has* to go at the point the class
is defined. This could be at the other end of a hierarchy of
generic instantiations. The result is that the implementation
requirement (needs a comparison operator) has propagated up the
generic hierarchy to some otherwise completely independent code as an
interface requirement. I'm sorry I can't explain this any better!
(should I give a code example?)
--
Adrian ad******@sbcglo bal.net wrote: Consider a military commmand and control system, a complex system with a lot of requirementss built in. Now, think of this system in terms of its size: 4.5 million lines of source code.
But not all lines of source code are created equally. Written in a
more expressive language the application might be only half that size,
or most likely even less.
Martin Krischik wrote: Shure it is true: The C++ ISO standard has ruffly 200 pages more then
the Ada ISO standard. The C standard is a few pages shorter - but C
hasn't got object orientation, concurency, real time and distributed system
included.
No surprise there. The C++ standard covers the C++ standard library.
But prove me wrong and show me any successful slim language - which
has not become fat (either by language or by build in library) withing 10
years of becomming successfull.
Personally I prefer slimmer languages and fatter libraries whenever
possible.
On Mon, 14 Mar 2005 19:29:25 GMT, Dr. Adrian Wrigley wrote: On Mon, 14 Mar 2005 20:43:08 +0200, Ioannis Vranos wrote:
Dr. Adrian Wrigley wrote:
the problem as I suggested in my previous post is that you have to pass in the comparison operator or hash function down the tree of template/generic instantiation, (composing them along the way) if you want to use maps/hashes.
In the standard library containers and algorithms case you do not pass any function to the container. operator< is implicitly used.
The comparison operator here seems to be a generic formal function parameter with a default value. This must be available at instantiation. The operator becomes part of the interface (implicitly or explicitly) for any code instantiating the std::map. Where does the code for the comparison operator go? It *has* to go at the point the class is defined. This could be at the other end of a hierarchy of generic instantiations. The result is that the implementation requirement (needs a comparison operator) has propagated up the generic hierarchy to some otherwise completely independent code as an interface requirement. I'm sorry I can't explain this any better!
It can be formulated in two words: "contract model" is what C++ templates
lack.
--
Regards,
Dmitry A. Kazakov http://www.dmitry-kazakov.de
Dr. Adrian Wrigley wrote: On Mon, 14 Mar 2005 20:43:08 +0200, Ioannis Vranos wrote:
Dr. Adrian Wrigley wrote:
the problem as I suggested in my previous post is that you have to pass in the comparison operator or hash function down the tree of template/generic instantiation, (composing them along the way) if you want to use maps/hashes.
In the standard library containers and algorithms case you do not pass any function to the container. operator< is implicitly used.
The comparison operator here seems to be a generic formal function parameter with a default value.
I think this description is o.K. for Ada, but perhaps not
for C++. E.g. you can place the following in three different
files (modules), somewhat like in Ada, and you don't have
to write the < into the module containing the compared type.
// 1
#include "comp.h"
#include <map>
bool operator< (V a, V b) { return a.val() < b.val(); }
int main()
{
std::map<V, float> m;
V key1, key2 = V(3);
m[key1] = 1.0;
m[key2] = 1.0;
return 0;
}
// 2
class V {
int v;
public:
V() : v(0) {}
V(int val) : v(val) {}
int val() const;
};
// 3
#include "comp.h"
int V::val() const {
return v;
}
Georg
Dr. Adrian Wrigley wrote: The comparison operator here seems to be a generic formal function parameter with a default value. This must be available at instantiation. The operator becomes part of the interface (implicitly or explicitly) for any code instantiating the std::map. Where does the code for the comparison operator go? It *has* to go at the point the class is defined.
Yes. However if you later convert to a hash container, it can remain
around unused in the particular container.
This could be at the other end of a hierarchy of generic instantiations. The result is that the implementation requirement (needs a comparison operator) has propagated up the generic hierarchy to some otherwise completely independent code as an interface requirement. I'm sorry I can't explain this any better! (should I give a code example?)
Yes, also operator< is used to all containers and algorithms where a
comparison takes place, like sorting algorithms (std::sort,
std::stable_sor t, etc).
I can not understand how this could be avoided for such operations and
containers, since a comparison is required.
--
Ioannis Vranos http://www23.brinkster.com/noicys
CTips <ct***@bestweb. net> writes: Robert A Duff wrote:
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. In fact, practically every programming language outside the C family has this feature. It's quite useful -- almost essential in multi-threaded programs. - Bob
Yeah, and don't ask what it costs you. I'd carefully forgotten about all the grungy details about displays and static/dynamic chaining, and you had to remind me. I particularily like solutions that reserves a register for the top-of-display/top-of-static-chain. Thats right - blow away a register for that. And then of course the cost of maintaining/walking those structures.
I beg to differ. Uplevel references can be implemented as efficiently
as parameter passing (which is what you normally do in C-family
languages as a substitute). And it can cost nothing when not used.
It can also cost nothing when the procedures involved can be inlined
(which is a very common case -- the reason I'm writing a nested procedure
is usually so I can pass it to an iterator, and both the iterator and
the nested procedure are usually small enough to deserve inlining).
(I'm not a big fan of displays, by the way.)
If you need thread-private storage, there are *much* cheaper solutions.
This seems like a nonsequitor -- thread-private storage and uplevel
references are different things, with different (though somewhat
related) purposes. C and C++ have neither, which can make using thread
packages painful, though gcc supports uplevel references (for both C and
Ada, and I think C++ also).
And having implemented both, I'd say thread-private storage is
generally more expensive than uplevel references. What's your
much cheaper solution?
- Bob
kevin cline wrote: Personally I prefer slimmer languages and fatter libraries whenever possible.
However C++ has also the ideal to be able to write these libraries with
the language itself.
--
Ioannis Vranos http://www23.brinkster.com/noicys
Dmitry A. Kazakov wrote: It can be formulated in two words: "contract model" is what C++ templates lack.
I think "explicit contract model" is slightly better, and perhaps
you can say something about the closure that the compiler needs
to find out whether a contract is fulfilled (Can_Copy etc.)?
Georg This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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.
|
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...
|
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...
|
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...
|
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
| |
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
|
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
|
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...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |