473,839 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# vs. C++

I don't want to start a war but why would I choose one over the other?
First and foremost I need to keep in mind marketability of the skill and
the future of the language.

I'm getting the feeling I'll be moving from VB to one or the other. I
have some say on which but perhaps not the final decision. I have used
C and C++ a little bit years ago. I have no experience in C#. I don't
expect it to be that difficult but I hate remembering the idiosyncrasies
of too many languages so I'd like to pick one C# or C++ and make the
right choice.
Jun 27 '08
151 4297
RFOG wrote:
"Arne Vajhøj" <ar**@vajhoej.d kescribió en el mensaje de noticias
news:48******** *************** @news.sunsite.d k...
>RFOG wrote:
>>Then, Alvin, next Windows will be done in C#?

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(*).
You will need something native to do that.

But that is a microscopic part of an OS like Windows Vista.

Jun 29 '08 #111
Fernando Gómez wrote:
Arne Vajhøj wrote:
>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 !

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...
There is still a lot of MFC apps out there. MS has a lot themselves.

But new apps will be done in Win Forms or WPF.

And eventually that will change the desktop landscape.

Jun 29 '08 #112
Andre Kaufmann wrote:
Jon Skeet [C# MVP] wrote:
>Daniel James <wa*********@no spam.aaisp.orgw rote:
>>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.


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.
What do you mean by "has been officially been restricted" ?

The JVM specs are public so anyone can target it. SUN has released
some other languages for the JVM themselves.
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 ?
Yes. No problem.

Jun 29 '08 #113
Daniel James wrote:
Did you notice that the very next paragraph of the bit you snipped said:
>>... and there are compilers for languages other than Java that
target the JVM, though I understand that the design of the JVM
specificall y makes it hard to taget it 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.
That is one of the worst pieces of logic I have seen in a long time.

You can not conclude that:

the JVM is not suite dfor C/C++ =the JVM is only designed for one language

There are actually other languages than C/C++ in the world.

And your impression of SUN's policy sound totally out of touch
with reality.

SUN has released several other languages for the JVM.
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
Ada, Python, Ruby etc. are all used commercially.

Jun 29 '08 #114
One day somebody tell something like the following:

"Work with C#, and learn C++"

I explain it in my opinion; C# is easy to learn, and I consider C++ (not
only C), is a little difficult to use for a begginer. In the other hand, the
most of programmers develop in C++; For example, I think Windows 9x,nt,xp,2k
were designed with c++6. So, with C++, you could do all you need and want,
but... there would be an easiest way to do the same with C#.

Actually there're too many platforms, devices and.... any more? Programming
languages, are not reduced to C++, C# or VB, in the other hand there're
Java, Perl, Python, Ruby. And other platforms, like Unix,Solaris,No vell.

When you use a .NET language, you're falling down to Windows OS, but ... you
know. If you're a programmer, you maybe would like to do a program that runs
at any platform. Solution? Java.

In addition, I only see a problem with Java, and is about execution time;
but the same problem is when you're running a .net app. Slow, slow, slow,
...... But the same Java app, runs on other platforms.

Learn a lot of language, think about the problem, and decide with language
must you use looking at the problem, may be C#, maybe C, maybe Java, ....

"Work with C#, and learn C++".

"Cor Ligthert [MVP]" <no************ @planet.nlescri bió en el mensaje
news:%2******** *********@TK2MS FTNGP06.phx.gbl ...

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.


"cj" <cj@nospam.nosp amschreef in bericht
news:uK******** ******@TK2MSFTN GP06.phx.gbl...
>>I don't want to start a war but why would I choose one over the other?
First and foremost I need to keep in mind marketability of the skill and
the future of the language.

I'm getting the feeling I'll be moving from VB to one or the other. I
have some say on which but perhaps not the final decision. I have used C
and C++ a little bit years ago. I have no experience in C#. I don't
expect it to be that difficult but I hate remembering the idiosyncrasies
of too many languages so I'd like to pick one C# or C++ and make the
right choice.

Jun 29 '08 #115
Andre Kaufmann wrote:
I don't know the interfaces today. The good old JNI interface was a pain
to deal with.
JNI is for JVM -native.

JVM -JVM is different.
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 ?

See example below.


=============== =============== =============== =============== ========

C:\>type P.py
import J
print "I am Python"
o = J()

C:\>type J.java
public class J {
public void test() {
System.out.prin tln("I am Java");
ada_test.adaini t(); // Ada runtime need to be initialized
C:\>type A.adb
with Ada.Text_IO; use Ada.Text_IO;

procedure A is

Put_line("I am Ada");
end A;

C:\>jgnatmake -I\jgnat-1.1p\JavaAPI A.adb
jgnatbind -aO./ -aO\jgnat-1.1p\JavaAPI -I- -x a.ali
jgnatlink a.ali

C:\>javac -classpath . J.java

C:\>call jythonc P.py
processing P

Required packages:

Creating adapters:

Creating .java files:
P module

Compiling .java to .class...
Compiling with args: ['C:\\SUNJava\\j dk1.3.1\\bin\\j avac', '-classpath',
'C:\\jython21\\ jython.jar; ... (all my jar files cut out)]
0 Note: Some input files use or override a deprecated API.
Note: Recompile with -deprecation for details.
C:\>java -cp
..;C:\jgnat-1.1p\lib\jgnat. jar;C:\jpywork; C:\jython21\jyt hon.jar P
I am Python
I am Java
I am Ada
Jun 29 '08 #116
Andre Kaufmann <an************ *********@t-online.dewrote:
Hendrik Schober wrote:
>Rudy Velthuis <ne********@rve lthuis.dewrote:
>>Hendrik Schober wrote:

You can always throw processing power at this problem
(www.xoreax.com). This worked great for a company I used

Thanks for the link.
>>> to work for and turned 60mins into 12mins.
Still a long time. <g>

Yes, but this was several MLoC. And usually you don't
have to compile /everything/ during writing/fixing

Yes, agreed. But in a large team it's still a pain to start the build
process over and over again, because in your local project it compiled
fine but in another project some weird side effect causes a compilation
I'm not sure what you're getting at.
Yes, include files and macros are a PITA. But, as I said,
it easily gets better by using more hardware resources.
And that's a cheap way to solve a problem. How much your
language supports you in writing correct code is IMO far
more important.
Even if I use processing power, C++ still compiles way more slower than
most of the other languages do. Currently our build time is 30 minutes,
which has been 3 hours before we switched to a quad core system.

I could live with the compilation time, if the slow down would be caused
by the complex syntax of C++ only and if that would be outweighed by the
productivity increase by all the goodies of C++ (templates, RAII etc.).
But since the slow down isn't caused by the complexity, but because the
compiler has to compile code over and over again, I think it's a huge
loss of productivity for - nothing - .
Yes, agreed. But still. We used to use several dozen CPUs
for one build. Since every developer has a couple of them
and since most of the time developers are thinking or
typing, their CPUs are available for this most of the time.
With this setup, /linking/ was the worst bottleneck, not
If compile-times are your worst problem, then that's good.
Buy some IncrediBuild licenses, get over it, and focus on
writing correct code.
[snipped other points I mostly agree with]

Sp******@gmx.de is never read
I'm HSchober at gmx dot de
"I guess at some point idealism meets human nature and
explodes." Daniel Orner
Jun 29 '08 #117
Andre Kaufmann <an************ *********@t-online.dewrote:
I had a huge problem, with template virtual base classes and somewhere
in the object hierarchy the base function hasn't been overridden and the
compiler logically didn't complain about it. Fortunately I had VC which
has a proprietary extension supporting override for native code too to
ensure that the compiled code does what I expected it to do.

I was only told in the forum that this is a minor problem and therefore
there is no need for override to get into the next standard.
I don't use this coding style anymore [...]
And I think that's the important statement here.
Deep inheritance hierarchies and "pure OO" are,
fortunately, not hip anymore.
>Maybe if someone were to come up with a standard for some sort of
meta-code representation then different languages would be able to share
template representations that had been compiled (or part-compiled) down
to that meta-code. The "export" feature in C++ does something along
those lines, but AIUI the intermediate form is still largely C++.

Unfortunately "export" doesn't do what it's meant to be. It doesn't
separate translation units. But yes, I agree that templates could be
supported over language boundaries too.
Google for discussions I had here with Daveed Vandervoorde
and Walter Bright about 'export'. Daveed assured that it
would solve what is my worst problem with templates: That
I not only need to put the template itself in headers, but
also all the templates it depends on. ('namespace detail',
anyone?) That makes for thousands of LoC in headers and,
according to Daveed, 'export' would solve this.

Sp******@gmx.de is never read
I'm HSchober at gmx dot de
"I guess at some point idealism meets human nature and
explodes." Daniel Orner
Jun 29 '08 #118
Daniel James <wa*********@no spam.aaisp.orgw rote:
In article news:<ue******* *******@TK2MSFT NGP05.phx.gbl>, Hendrik Schober
>Daniel James wrote:
>>Certainly the current Visual C++ (Dinkumware) runtime doesn't seem
to use sprintf.

That would have been a pleasant surprise. But outputting
an 'int' using '<<' certainly lands you in 'sprintf()'. :(

Yeah, sorry, I boobed. Andre Kauffman has pointed out elsethread that I
didn't dig deep enough into the Dinkumware code to get to the
::sprintf_s call.

That's rather disappointing ... num_put::do_put knows that what it's
printing is an int, so it passes a format string to sprintf_s and gets
it to decode that to determine something its caller already knew. Why
can't do_put directly call whatever sprintf_s calls to process ints?

Maybe the efficiency gain from doing that would be trivial, but from
where I sit it looks like the code just makes work for itself.
As I wrote, Dietmar Kühl used to have a stream
implementation which he claimed (I never used it) to
be much faster than the then common once and ISTR him
mentioning that one of the reasons is he doesn't use
'printf()' for outputting.
I'm sure there's other reasons why streams are slower
than other IO implementations (e.g. sentries for every
IO operation), but the idea to throw away compile-time
type info and having to find out all about it again at
run-time does seem "funny".

Sp******@gmx.de is never read
I'm HSchober at gmx dot de
"I guess at some point idealism meets human nature and
explodes." Daniel Orner
Jun 29 '08 #119
Daniel James wrote:
In article news:<48******* *************** *@news.sunsite. dk>, Arne
Vajhøj wrote:
>Good OOP is about limiting choices.

No it isn't. It's about a certain kind of encapsulation.
Encapsulation is limiting choices.
>You encourage or force developers to do things the right way.

Encouragement and forcing are very different games. In solutions that
lend themselves well to OOP the benefits to be gained from OOP are
encouragement enough -- no need for the language to force the issue.
I believe there is a reason that we use (forgive for using C# syntax):

public class FooBar
private int v;

and not:

public class FooBar
// Do not use this field directly
public int v;

Jun 30 '08 #120

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

Similar topics

by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL) on the server because of that. Our site will have an SSL certificate next week, so I would like to use AIM instead of SIM, however, I don't know how to send data via POST over https and recieve data from the Authorize.net server over an https...
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues to execute the code until the browser send his reply to the header instruction. So an exit(); after each redirection won't hurt at all
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which field is completed.
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. 354 roberto@ausone:Build/php-4.3.2> ldd /opt/php4/bin/php libsablot.so.0 => /usr/local/lib/libsablot.so.0 libstdc++.so.5 => /usr/local/lib/libstdc++.so.5 libm.so.1 => /usr/lib/libm.so.1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the column below. The viewer can select states from the drop down lists above the other two columns as well. If the viewer selects only one, only one column fills. If the viewer selects two states, two columns fill. Etc. I could, if appropriate, have...
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the user comes back to a page where he had a submitted POST data the browser keeps telling that the data has expired and asks if repost. How to avoid that? I tried registering all POST and GET vars as SESSION vars but
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url http://www.mis.gla.ac.uk/biquery/training/ but each of the courses held have maximum of 8 people that could be
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value to :parameter I dont like the idea of making the SQL statement on the fly without binding parameters as I dont want a highly polluted SQL cache.
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the results of the picture half the size. The PHP I have installed support 1.62 or higher. And all I would like to do is take and image and make it fit a 3x3. Any suggestions to where I should read or look would be appreciated.
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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,...
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: 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,...
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: 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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.