C# vs. C++

A

Arne Vajhøj

Andre said:
Hm, why ? Singularity / Cosmos are operating systems in C#. The
MicroFramework targets embedded devices.

An desktop/server OS is huge today.

Large parts of an OS can be written in managed code.

But some things has to be written in unmanaged code.

I don't know how much. Maybe 5%.

Even Singularity has a small amount of C++ and assembler.

If we go to embedded devices with much less features then I would
expect the percentage to go up.

And do not get me wrong - I am expecting the next major OS to have
huge part written in managed code. But as expressed in another
subthread - we may have to wait some time for the next major OS.
Boost is a good, cool library - sure. But these libraries get somewhat
bloated, because of all the template stuff and compilation slows down
more and more.

Compilation speed is usually not important.
- LINQ
- Delegates
- Library, which isn't bound to a single language
- Lambda expressions
- Implicit typed variables
- and many more

Actually the Java library is not bound to the Java language. You
can use it in Ada (jGnat), Python (Jython) etc..

Arne
 
A

Arne Vajhøj

David said:
C++/CLI as a first class .NET language does indeed appear doomed. Maybe
using C++ for .NET was a bad concept from the beginning, or maybe it was
done in by the flawed initial version of MC++. But, anyway, it seems dead.

C++/CLI is great for inter-op, but that is a limited market compared to
all the things that C# can do in .NET.

But native C++ lives on, both as a cross platform language, and in many
MFC/Win32 applications that are never going to switch to .NET. The
Visual C++ team is strongly committed to improve the native coding
experience in the next version of Visual Studio, after many years of
neglect.

I tend to agree.

People that want to write managed code chose C# instead of C++/CLI. It
is simply easier.

C++ will most certainly live on for many years.

I am a bit skeptical about MFC though. I think MFC will be
squeezed hard by .NET in the next 10 years. As the UI's need
to get a major rewrite then the apps will switch to .NET !

Arne
 
A

Arne Vajhøj

Daniel said:
10 first class programmers will do more useful work in less time than
50 mediocre programmers ... and you will get fewer bugs.

In a world with concerns such as money you can't afford the mediocre.

If you look out in the real world, then you will see that
is not the general opinion.

Arne
 
A

Arne Vajhøj

RFOG said:
Then, Alvin, next Windows will be done in C#?

Next OS from MS could very well be done in C#.

But don't hold your breath until it hits the streets.

Arne
 
A

Arne Vajhøj

Daniel said:
I think your notion of "good OOP style" is misplaced. You are saying
what Java programmers have been saying that for some time -- because
Java doesn't give them any choice.

You are, of course, free to follow that convention in C++ -- but if you
do so you will be limiting your design choices.

Good OOP is about limiting choices. You encourage or force
developers to do things the right way.
There is nothing
inherently wrong with allowing a class to inherit from multiple
concrete base classes, and doing so can be a useful way to encapsulate
common aspects of behaviour shared by several classes. This can
simplify design and reduce code sizes.

Multiple inheritance has a rather bad track record.

Arne
 
P

Pavel Minaev

Multiple inheritance has a rather bad track record.

A correction: _implementation_ multiple inheritance _in C++_ has a
rather bad track record. Implementation MI can work just fine if
properly done - Eiffel is a testament to that.

Even so, give me interfaces and syntactic sugar to delegate their
implementation to a wrapped object over implementation MI any day. The
problem is, C# has neither, and writing all those one-liner methods
that just pass the arguments on is tedious. Hm, perhaps it's worth
adding the appropriate feature request to VS Feedback.
 
C

Cor Ligthert [MVP]

cj,

As I often have written

VB for Net and C# are both the children of C++ and VB6.

(The VB6 part will probably be denied by people not knowing VB).

Although there is never made a VB6 for Managed code while that is there for
C++, what is of course helpfull to use both Com and Net programming, as was
often asked by dyhards from VB6, is C# made for developping in an IDE, while
C++ still is based to program using by instance a notepath.

Cor
 
R

RFOG

Arne Vajhøj said:
Next OS from MS could very well be done in C#.
We have a phrase: "confía en Dios y no corras", that will be translated as
"be confident with God and don't run".

Of course, C# can deal with LDT, GDT, vector interrupts, rings, direct
hardware access and of course microprocessors executes MSIL directly(*).
But don't hold your breath until it hits the streets.

:)


Arne

(*) Please, read as a irony.
--
Microsoft Visual C++ MVP
========================
Mi blog sobre programación: http://geeks.ms/blogs/rfog
Momentos Leves: http://momentosleves.blogspot.com/
Cosas mías: http://rfog.blogsome.com/
Libros, ciencia ficción y programación
========================================
Cualquier problema sencillo se puede convertir en insoluble si se celebran
suficientes reuniones para discutirlo.
-- Regla de Mitchell.
 
F

Fernando Gómez

Arne said:
I tend to agree.

People that want to write managed code chose C# instead of C++/CLI. It
is simply easier.

C++ will most certainly live on for many years.

I am a bit skeptical about MFC though. I think MFC will be
squeezed hard by .NET in the next 10 years. As the UI's need
to get a major rewrite then the apps will switch to .NET !

Arne

The new version of MFC is just great! With the Ribbon, docking windows,
new common controls, MSN menus, and a bunch of other things... I wonder
why Microsoft is investing in MFC, if it is doomed...
 
J

Jon Skeet [C# MVP]

Daniel James said:
It's one of .NET's
significant advantages over Java (intermediate code engine targeted by more
than one source language) but that's about it.

<snip>

Um, there are *plenty* of languages targeting the JVM. Off the top of
my head:

Java (obviously)
Groovy
Scala
JRuby
Jython

That's without even bothering to think. Fortunately Wikipedia allows us
to continue not thinking and expand the list significantly:
http://en.wikipedia.org/wiki/JVM_Languages

I don't think even that list is exhaustive by a long chalk though.

(Personally I'd say there are plenty of other things that C# has over
the Java language and that .NET has over the JVM/JRE; Java's
portability is its main benefit over .NET in my experience.)
 
F

Fernando Gómez

Daniel said:
I'm also disappointed that modules won't be in C++0x, but I hope we won't
have to wait too much longer for them.

If I might interrupt for a moment, I think that the *only* true
advantage of using C# rather than C++ is that C# has a big standardized
framework so that programmers have a common high-level layer, so that
they don't have to directly deal with the OS.

C++ should be moving onto something similar, IMHO. As the C++0x is doing
with threads, regex, etc.

I know it's something really difficult, but that's a wish of mine.

Regards.
 
H

Hendrik Schober

Arne Vajhøj said:
Daniel James wrote:
[...]
10 first class programmers will do more useful work in less time than
50 mediocre programmers ... and you will get fewer bugs.

In a world with concerns such as money you can't afford the mediocre.

If you look out in the real world, then you will see that
is not the general opinion.

I see this when using just about every application.
And I hate it.

Schobi
 
A

Andre Kaufmann

Jon said:
<snip>

Um, there are *plenty* of languages targeting the JVM. Off the top of
my head:

The point is that JVM has been officially been restricted to a single
language and wasn't meant to be open for other languages - don't know
it's current state in this regard.

And it's not only the runtime that makes the difference. Can you write
code in Java and use it easily from any other language targeting the JVM ?


Andre
 
J

Jon Skeet [C# MVP]

The point is that JVM has been officially been restricted to a single
language and wasn't meant to be open for other languages - don't know
it's current state in this regard.

I don't think it's ever been "restricted" - I don't remember Sun ever
telling people off for developing any of these languages, for
instance. Sun now employs the JRuby folk IIRC, and gave their blessing
to Groovy too.

Heck, there's even an API (in Java 6 IIRC, but it *might* only be in
Java 7) specifically for scripting, to make binding etc consistent
between different scripting languages targeting the JVM.
And it's not only the runtime that makes the difference. Can you write
code in Java and use it easily from any other language targeting the JVM  ?

Absolutely - and the reverse, in many cases. For instance, you can
easily call Groovy code from Java, should you wish to.

I can't imagine anyone designing a language to run on the JVM which
*wouldn't* take advantage of both the standard APIs and the wealth of
3rd party libraries available - and that will include any extra Java
code you write yourself.

Jon
 
A

Andre Kaufmann

Daniel said:
I didn't say you couldn't use C# to write an OS -- most OS code doesn't
need to be particularly low level. My remark about C#'s unsuitability for
writing drivers should be taken in the context of Windows, which provides
no underlying support for C# (or any .NET language) to perform direct
access to the hardware -- a prerequisite for driver writing.

I don't know much about Singularity ... but as I understand it although the
OS (including driver code) is described as being "all written in C#" the
drivers do rely upon an assembler-coded library for all direct hardware
manipulations. That does rather change the nature of the game.

Singularity has a small amount of assembly code and it's using a native
C# compiler. Cosmos however is meant to be 100% C# code.
[...]

It's true that compilation is slowed somewhat by extensive use of
templates. That's the trade-off: you get expressive language/library
features with impressively fast run times, but you have to pay a little in
build times to get it.

The point is C++ is not (always) that fast, only if you are an
experienced (expert) C++ developer the resulting C++ application will be
much faster.

Short example (I never thought C++ to be slower in writing to files):
The code is attached below and does nothing but simply writing 5000000
integers to a text file.


C++ COMPILER X: AMD 3500+ WIN VISTA
fprintf: 8417 ms
iostreams: 7329 ms
sprintf: 4463 ms
itoa: 2001 ms
C#: 2261 ms


C++ COMPILER X: INTEL QUAD CORE WIN2008
iostreams: 5091 ms
fprintf: 4586 ms
sprintf: 2322 ms
itoa: 1263 ms
C#: 1045 ms


C++ COMPILER Y: INTEL QUAD CORE WIN2008
fprintf: 4485 ms
sprintf: 2360 ms
iostreams: 2047 ms
itoa: 1656 ms
C#: 1045 ms


Another point is C++ could compile (nearly) as fast as any other
language. But therefore C++ must either get rid of (global) macros, or
introduce modules.

Let's not get bogged down in irrelevant specifics -- the point here is that
C++ allows something like Boost::function to be written as library code in
C++ itself. Delegates in C# are only possible because delegates are part of

If you look at functional languages targeting .NET e.g. F# and see what
is possible in these language then delegates just look like a simple toy
- and I think they proof that delegates could have implemented in C#
directly too.

But why have they to be implemented in a library ? C++ could have
integrated delegates from the beginning and add some extensional stuff
into a library, instead it's using IMHO a rather ugly syntax for member
function pointers, which are bound to a single class type.
I know boost::function is perhaps much more powerful than a direct
implementation would be, but it could be still extended with a library
too. I don't want to state that boost::function is bad, it's well
written and an perfect extension, I only think a direct implementation
could perform better.
the .NET runtime support system, and if they weren't there would be no way
to add them to C#.

I don't know for sure, since you can easily write a .NET compiler by
yourself using the .NET runtime compiler support. Also I've seen many IL
(the .NET assembly code) based extensions, which extend the language or
..NET framework. So I think it would be possible, but the big advantage
is that, as the framework has implemented delegates, you can use it in
every language and pass the pointers over dll boundaries without any
hassle.

[snip]
After I had replaced all the TMP stuff by generated code the code size
could be reduced to 1MB.

How long ago was this? Compilers have got much better in recent years.

Hm, 3 years ago.
I think some of the things in Loki are nice from an academic standpoint but
a bit too abstruse for everyday use in most teams. They show the power of
C++ admirably and they may perform a useful task in very specific
circumstances but you don't need to reach such dizzying heights of
complexity to gain real benefits from TMP or the other C++ features that
raise it above the also-ran languages.


Yes, C++ has macros. If you don't like them don't use them.

The main problem about macros is that the C++ compiler has to use them
too. So if it compiles a unit with header file a, it can't use the
already preprocessed and compiled intermediate code of header in another
unit, because a simple macro could convert the whole code in the
preprocessing stage.

This - and mainly this - makes the C++ compiler that slow, because it's
compiling code over and over again. There are solutions like precompiled
header files, but it's not a standardized solution.
There is a lot of C++ that is inherited from C in order to maintain as much
compatibility as possible between the languages. That may look like a
disadvantage to C++ now, but when C++ was new it was a great help to
achieving acceptance for C++ -- because it was so very well integrated with
the dominant language of the day: C.

I agree that it's was good for C++ to be based and compatible with C,
however it's not so good IMHO that it hasn't been separated more from C.
[...]
Delegates and labmda have been added TO C++ IN C++ (in Boost) ... which is
something you couldn't do in C#.

Perhaps. But if you look at the library, how many code there's inside to
deal with the differences of different C++ compilers I think it wasn't
an easy task ;-).

It has the advantage that it can be used by any (compliant) C++
compiler, but the downside is huge libraries and somewhat slower code.
Implicit typed variables are coming to C++ (auto) ... but the need for them
is mostly driven by templates -- what good are they in C#?

The same reason - >generics< and LINQ has also driven them. I'm not an
C# expert, I'm developing more in C++ so I might be inaccurate.
[...]
some special innovation of .NET, because it isn't. It's one of .NET's
significant advantages over Java (intermediate code engine targeted by more
than one source language) but that's about it.

It's not only about it. There could be a Windows standard for all
Windows compilers to have the advantages for natives languages too.
Try to export a template code in C++ in a Windows DLL and use it from
another language - in .NET it's simply no problem.
But the only standard there's in Windows, is how to export flat
functions. I wished at least the name mangling would be somewhat
standardized.
[...]
D is interesting too ... can that not be used together with DM C++? I must
say I haven't tried ...

It somewhat supports using C++ (indirectly), but as the developer said,
if it would fully support C++ - it would be a full fledged C++ compiler,
which would be not that simple to >implement< ;-).
Incidentally, Andrei Alexandrescu presented a paper this spring on a new
version of DM C++ with functional programming primitives that he's been
working on with Walter Bright ... interesting stuff, but I don't think most
of the audience were quite convinced.

Hm, interesting thanks for mentioning it.
Have you used another language than C++ too, to make a good
comparison?
[...]
Cheers,
Daniel.



Code sample: ( I know that fstreams can be somewhat tweaked)

fprintf:


FILE* file3 = fopen("fprintf.txt", "w");
for (unsigned int i = 0; i < 5000000; ++i) fprintf(file3, "%d", i);


sprintf:


FILE* file = fopen("sprintf.txt", "w");
char buffer[8];
for (unsigned int i = 0; i < 5000000; ++i) {
sprintf(buffer, "%d", i);
fwrite(buffer, strlen(buffer), 1, file);
}


itoa:
FILE* file2 = fopen("itoa.txt", "w");
char buffer[8];
for (unsigned int i = 0; i < 5000000; ++i) {
itoa(i, buffer, 10);
fwrite(buffer, strlen(buffer), 1, file2);
}


iostreams:
ofstream f("ofstream.txt");
for (unsigned int i = 0; i < 5000000; ++i) f << i;


C#:
StreamWriter f = File.CreateText("csharp.txt");
for (uint i = 0; i < max; ++i) f.Write(i);



Cheers Andre
 
J

Jon Skeet [C# MVP]

Daniel James said:
Did you notice that the very next paragraph of the bit you snipped said:

I didn't, actually. Sorry about that - it does sort of make a nonsense
of the sentence that I *did* quote though.

And yes, I agree that it would be pretty hard to target the JVM with C
or C++.
So, yes, of course, I agree with you. The point I was making in the bit
you didn't snip is that Java is a single-language environment BY DESIGN.
The Java zealots at Sun would have you believe that you don't need any
language other than Java and that Java is all the languages that you
will ever need ... at least, that was their mantra last time I passed by
the temple.

I wouldn't put it as strongly as that. I think there's a big difference
between a platform being deliberately designed to only have one
language targeting it, and a platform being designed explicitly for a
single language with little thought to trying to make life easier for
other languages.

I would put Java into the latter camp rather than the former. Even if
some Java fans think there's no point in having other languages
targeting it, I'm not aware of any ways they've made it *deliberately*
more difficult for other languages in a DRM-like way.
All the same, most of the languages you list -- and those in the
Wikipedia article you cited -- are experimental "academic" languages,
which aren't likely to be anyone's first choice for commercial
application. Groovy is obviously different, as it's designed to work
alongside Java -- I've not used Groovy but I understand that the synergy
there is good. The same is true to some extent of Jython, in that I
don't think anyone would choose Jython (over Python) unless their
project also used Java.

But that's the point - if their project *does* use Python or Ruby
already, or if they've already got a lot of code in Java that they want
to use later with Python or Ruby - then Jython and JRuby are a natural
fit.

If we're talking about languages which are common "first choices" for
commercial applications, even .NET's relatively thin on the ground,
with VB.NET and C# taking the lion's share and C++/CLI and F# pulling
up the rear - at an educated guess. Languages like Boo aren't exactly
commonplace.
AspectJ is interesting, but AIUI that's an extension of Java rather than
a different language.

OTOH A remember being very impressed with the AppletMagic Ada for JVM
when I first looked at it -- too long ago now -- but I'm not sure it's
still around. Ada is a real language (one that really deserves to be
better known outside the war-toys factories) and it's interesting that
you can run it well on the JVM.

Right. I'm interested in Scala, as there used to be implementations for
both .NET and the JVM - and because it looks like a nice language. I
haven't had a close look though, and I believe the .NET port is out of
date.
I agree. The .NET team had the benefit of seeing the JVM in action and
of learning from its shortcomings. Their runtime is better in many ways
.. but Java has the market penetration and I doubt very much that .NET
will ever displace it completely, even on Windows.

Absolutely - I expect both to go on for quite some time, which is fine
by me. (I'm currently working just in Java professionally, and I have
no wish to leave my current employer - but I do hope I write some C#
professionally again at some point.)

I haven't replied to your other posts about LINQ, by the way, but I
think you'd be wise to look into it further - it sounds like you may
have the wrong end of the stick to some extent. It's certainly not like
embedding SQL into C# - there's a lot more to it than that. Personally
I think that LINQ to Objects (the "in process" handling of collections)
is of more use to most people than LINQ to SQL etc, though obviously
the latter has more of an "ooh" and "aah" quality to it.
 
A

Andre Kaufmann

Jon said:
On Jun 26, 6:07 am, Andre Kaufmann <andre.kaufmann_re_mo...@t-
online.de> wrote:
[...]
I don't think it's ever been "restricted" - I don't remember Sun ever
telling people off for developing any of these languages, for
instance. Sun now employs the JRuby folk IIRC, and gave their blessing
to Groovy too.

I only read about it some years ago. Perhaps restricted was the wrong
word. But in the past other languages haven't been officially let's say
supported by Sun.

This might have changed today however, since Java is Open Source now.
Heck, there's even an API (in Java 6 IIRC, but it *might* only be in
Java 7) specifically for scripting, to make binding etc consistent
between different scripting languages targeting the JVM.


Absolutely - and the reverse, in many cases. For instance, you can
easily call Groovy code from Java, should you wish to.

I don't know the interfaces today. The good old JNI interface was a pain
to deal with.
Is it really that simple in Java too:

- Write a class in any language and compile
- Compile the code to a Dll
- Use the code from any other language targeting the JVM too ?

I read only about using Java classes and vice versa from other
languages, but not how different languages would interact.
I can't imagine anyone designing a language to run on the JVM which
*wouldn't* take advantage of both the standard APIs and the wealth of
3rd party libraries available - and that will include any extra Java
code you write yourself.

Jon

Andre
 
J

Jon Skeet [C# MVP]

Andre Kaufmann said:
I don't know the interfaces today. The good old JNI interface was a pain
to deal with.
Is it really that simple in Java too:

- Write a class in any language and compile
- Compile the code to a Dll
- Use the code from any other language targeting the JVM too ?

Well you wouldn't compile to a DLL. You'd compile to class files, and
then potentially jar them up. At that point, there's no difference
between a Java-created class and a class created by a different
language, other than what it chooses to do. (A Groovy class would be
full of calls to the Groovy libraries to do dynamic calls etc.)

Of course, it depends on whether your chosen language *has* a compiler
- some may not. If it doesn't, you'll probably need to use BSF or Java
6's scripting support. It looks like that's the way to go for JRuby,
for example. Jython has jythonc, but that's basically deprecated. See
http://wiki.python.org/jython/JythonMonthly/Articles/September2006/1
for how to run Jython code from Java without jythonc.

It looks like Groovy is one of the best integrated languages in this
respect.
I read only about using Java classes and vice versa from other
languages, but not how different languages would interact.

If you ever get hold of Groovy in Action, we've got a whole chapter
about integrating Groovy - chapter 11.
 
A

Andre Kaufmann

Daniel said:
Interesting. I've read about Singularity but not about Cosmos (in fact,
I thought Cosmos must be another name for Singularity when you mentioned
the two together in your last post).
The question, then, is how? Presumably Cosmos must touch the metal
somehow ... or is it designed as a guest OS to be run within another,
native, OS?

I don't know all the internals. AFAIK Cosmos includes a compiler, which
translates the IL code generated by C# to x86 code.

No basically it is C# translated directly to native code, with some
extensions to let C# interact directly with the CPU.
[...]
Short example (I never thought C++ to be slower in writing to files):
The code is attached below and does nothing but simply writing 5000000
integers to a text file.

What are COMPILER X and COMPILER Y?

Windows C++ compilers, I don't think that the vendors are quite
interesting and I don't want to start compiler wars ;-).
Hmm ... there has to be a reason that C# comes out looking so good ...

Do all the programs produce identical output? What, exactly, did you
time (e.g. do you close the files/streams in the timed section of the
code in each case)?

Close doesn't matter and yes all produce the identical output.
The fprintf and sprintf functions will always be slow as they have to
parse the formatting string each time as well as producing output, so I

The printf functions are commonly faster, because they don't have that
much overhead. IIRC correctly IOStreams (e.g. the ones shipped with
VC9.0) are using sprintf internally for formatting.
wouldn't expect them to do well. I'd expect the iostreams version to be
a good bit quicker and the itoa version to be the fastest. If I had to
guess I'd say that the C# version would be comparable to iostreams.

IOStreams are quite slow. At least the ones I know. The reason is that
much overhead due to localization, memory allocation for buffering and
too much code to run through for a simple task.
You could try another benchmark with boost::format -- I bet that would
be slower than any of them.

I think it was quite fast.
Modules are coming, eventually.

It's not global macros that are the problem, it's the fact that there's

I mean with global in brackets that macros can be redefined in each and
for each header file and that the propagate to other header files.
So global was perhaps misleading, setting a macro in the compiler
affecting the whole code compiled is not a problem.
no mechanism for the compiler to know that any macros referenced (in
include files, especially) have the same values in all compilation

Yes, that is the main problem.
units/for all builds. If the build system were smarter it could track
that and avoid recompiling header information that had already been
compiled with the same settings.

Therefore it must have an overview over the whole code must distinguish
different header files with the same name etc. I think modules will be a
better solution. IIRC the IBM C++ compiler had some kind of modules
implemented and was quite fast in compilation.
Macros can be a pain, but they can also be very useful ... I always
advise people to avoid using them if there is an alternative (e.g. use
const int (or even an enum) rather than a #define) but sometimes there
is no alternative and their use is beneficial.

I know and agree. I use them too. But they could have been restricted to
have an effect on one single header file or must be globally defined.
That's because they're functional languages, not because they target
NET -- take a look at Haskell or Erlang and see what they can do.

Yes, it hasn't something to do with .NET. F# is similar to ML, ML is
comparable with Haskell.
It should only proof that delegates can be implemented in C# directly,
as I stated in my recent post.
But why have they to be implemented in a library ? C++ could have
integrated delegates from the beginning and add some extensional stuff
into a library ...
[...]
quite a big language, and making it bigger still just to add a feature
that can be implemented in a library doesn't make good sense.

I know that it's a big no no to change the language. Heck it's even to
complex to add "override" to the language.
I agree that a library is much better regarding compatibility. But it
makes it quite hard for tools implementors (e.g. RAD tools / code
completion etc.) to deal with huge libraries.
I have only the feeling that delegates should be supported directly by
the compiler and that the libraries to implement them got somewhat bloated.
[...]
I wouldn't like to judge without seeing direct implementation and
benchmarking it ... but boost::function is pretty efficient, from what
I've seen.

They have improved, since there aren't that many heap allocations
involved anymore.

There is a comparison on:
http://www.codeproject.com/KB/cpp/CppDelegateImplementation.aspx
[...]
I think you're missing the point I was making. I wasn't saying that
there was no way you could add delegate support *to* C# if it didn't
have it, I was saying that there was no way you could add delegate
support *in* C# alone.

A - O.k. you mean the "template magic" allows C++ to implement delegates
as a library, while you can't in C#, because generics aren't that
flexible enough. Besides I think templates could be implemented in any
other language too, why should it proof the power of C++ ?
(doesn't mean that I don't like them).

I could argue C# to be more powerful because:

- I can compile code on the fly. E.g. I can compile regular expressions
and XSL stylesheets to perform faster as any C++ could to, because
it has to evaluate the regular expressions/stylesheets always.
I can even build and compile script code on the fly.

There are more examples - all languages have pros and cons.
But C++ isn't that effective always.
[...]
... but the big advantage is that, as the framework has implemented
delegates, you can use it in every language and pass the pointers
over dll boundaries without any hassle.

I'm sure that's true -- and it *is* an advantage of the environment, no
question ... but (again) it says nothing about the power of expression
of the C# language -- it says nothing about the ease with which *you*
can express complex concepts in *your* C# code.

O.k. yes. I only missed templates in C# for generic code. However, what
I'm badly missing in C# is RAII.

But you aren't restricted to a single language. If you want to express
complex concepts use another language like F# or C++/CLI and reuse the
code in C#.

Don't get me wrong, I still like C++ and it's my main developing
language. But I sometimes miss the developing experience of other
languages and I think the standardization process is quite slow.
[...]
Modules are probably the best answer, though.

Yes, I think that too. Unfortunately they are delayed and not part of
the upcoming standard.
[...]
I take the point that the CLI gives you a standard object representation
for all .NET languages, and lets you define an object in C# and
manipulate it in C++/CLI or VB.NET or whatever ... but you can't create
a template in a C++/CLI program and use it (instantiate it) in a C# or
VB.NET program -- because those languages have no conception of
templates.

Well, the .NET framework has Generics. They aren't that powerful as
templates, but on the other side you have the possibility to export
generic lists to other languages.
The implementation of templates in C++/CLI is not provided by the CLI,
but by the C++ compiler. Templates are therefore not visible to other
NET languages.

Yes. Besides security concerns and loosing the strong typing of
Generics, why shouldn't templates been implemented in other languages too ?

Thanks, I'll have a look at it.
I don't know how much sense they'll make to someone who wasn't at the
talk!

Cheers,
Daniel.

Cheers,
Andre
 
A

Andre Kaufmann

Arne said:
[...]
Boost is a good, cool library - sure. But these libraries get somewhat
bloated, because of all the template stuff and compilation slows down
more and more.

Compilation speed is usually not important.

Why ? For RAD tools it's IMHO essential and if 1000 developers wait
daily an hour for compilation they are loosing simply 1000 hours of
development time, besides the energy wasted.

I'm simply used to quickly recompile my code after a compilation error.
In C++ is meant to compile fast code. Why can't the compiler be not that
fast ? The sad story is - it could be.
[...]
Arne

Andre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top