Managed C++ vs. C++/CLI vs. C++

When I started my latest project where I needed some basic C libraries to access the Hardware. I thought I will use a Windows Forms Application with C++. I hoped this offers me writing normal C++ code and still use the new UI code from MS. In addition it would possible to port the application since the underlying C library is platform independent and C++ if correctly separated from the UI code should compile as well.

To bad it was not as easy as I hoped it will. The next time I might just chose an MFC Application where I can write native C++ code and I don’t have to bother with some magic C++ addition.

I had quite a hard time to figure out how I need to structure my application that it will work in managed mode. After some googeling I figured out that there are two different things: Managed C++ and C++/CLI. Managed C++ was the old addition from MS. With Visual Studio 2005 they added C++/CLI which is an ECMA standard and has a similar scope as Managed C++. The keywords of C++/CLI are no more marked with two underlines in front as it was with Managed C++. At the end I found an overview that explained me the strange keywords that I found in the new generated code.

The following links give a good overview about the differences between the C++ and C++/CLI:

The result of all this is that my application will not be portable at all since all the code is infected with CLI code. It would have been possible to separate the C++ code from the CLI code in such a way that it could be reused on an other platform but since it is only a prototype and it just has to work on windows. I will leave that for an other time. To separate C++ code from C++/CLI code it is necessary to write some glue code since CLI does not support all features from C++.

Computers and the human brain

I just read the introduction Chapter 19. – “Learning in Neural and Belief Networks” of AI A Modern Approach by Stuart Russell and Peter Norvig and am already very impressed.


Comparing brains with digital computers
Computer chips can execute an instruction in tens of nanoseconds, whereas neurons require milliseconds to fire. Brains more than make up for this, however, because all the neurons and synapses are active simultaneously, whereas most current computers have only one or at most a few CPUs. A neural network running ori a serial computer requires hundreds of cycles to decide if a single neuron-like unit will fire, whereas in a real brain, all the neurons do this in a single step. Thus, even though a computer is a million times faster in raw switching speed, the brain ends up being a billion times faster at what it does.

Currently I’m very busy with school and work. I wish I had time to read the whole book and implement the exercises in a programming language..

2008-01-04 | Posted in: ai | Comments Closed