Jump to content

Why don't people code in C# for development speed and then use a convertor to C++?

- - - - -

  • Please log in to reply
10 replies to this topic

#1
thegreatescape

thegreatescape

    Newbie

  • Members
  • Pip
  • 2 posts
That is the stupidest question in the world I am sure! But since it is much faster to code in c# (or any .net) and then just convert to C++ using an automatic convertor which improves performance and remove dependencies?

Humbly await your response, I am clueless quite clearly!:crying:

EDIT: Is it because of the memory management problems? But there are programs that claim to convert with good success rate, hmmz, look forward to a response.

Edited by thegreatescape, 19 November 2011 - 06:32 PM.
update


#2
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,254 posts
  • Location:C:\Countries\US

thegreateescape said:

That is the stupidest question in the world I am sure!

The only stupid question is the one that's not asked.

* * *

As for the question itself, I don't know C#, so I don't know much.

Like with JavaScript, it is possible to convert it to C/C++, but then it would be hard to manage all the dynamic typing. I think you could make structures, instead of just variables, where the structures tell what type of variable it is, and the value - or a pointer to the value - of the variable. But then you would also need some way of keeping track of memory allocations, etc. (like the garbage collector in JavaScript), or else you might not be happy with what things might turn out to be.

#3
thegreatescape

thegreatescape

    Newbie

  • Members
  • Pip
  • 2 posts
I read somewhere that it is possible but may come unstuck with certain libraries in .net framework not having equivalent translation into the C++ supported libraries. I wonder if a good way would be to translate everything it can and highlight the functions it doesn't know how to deal with and so you can sory them manually- maybe that is how these things work, and maybe that is lead to ineficient code and loss of performance. I wonder if you can just copy the .net library into the source and reference locally for the functions that dont have equivalents- but then.... hmm no use trying to work it out, guess will have to just try it and see one day.

#4
fread

fread

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 787 posts
Another thing is: people code in languages they are comfortable in. If i am comfortable in C and C++ why use C# to then convert it to C or C++. C# has it uses, as do the others.
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:

#5
Ancient Dragon

Ancient Dragon

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 400 posts
C# is a new language and not many programmers use it or have learned it. Its also not a portable language like C or C++ so there are many operating systems on which C# is useless.
Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
C# is closely tied with .NET, and has a number of language rules that don't translate easily to C++'s language rules. It would be easier to just do the equivalent code in managed C++, as a general rule. Also, once you're using .NET, you're including that in the C++ app as well, which may negate any speed gains you expected to achieve.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,254 posts
  • Location:C:\Countries\US

Ancient Dragon said:

C# is a new language and not many programmers use it or have learned it. Its also not a portable language like C or C++ so there are many operating systems on which C# is useless.

If it would be converted to C/C++, without Microsoft dependencies (ie .NET platform), it probably would be portable.

#8
Ancient Dragon

Ancient Dragon

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 400 posts
If you want portability then just write the program in C or C++ to begin with because that would be a lot easier and less time consuming.
Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.

#9
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Why don't we just use an editor like Unity and just copy code avoiding programming at all?
Because we enjoy C++.
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#10
fread

fread

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 787 posts

bbqroast said:

Why don't we just use an editor like Unity and just copy code avoiding programming at all?
Because we enjoy C++.
We also enjoy C. :thumbup:
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:

#11
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
If it's the Unity I'm thinking of, because it doesn't run on Linux :)
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users