Thread: Difference between C++ and VC++?

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    8

    Difference between C++ and VC++?

    Hello there, this is my first post... and I need to make it clear I'm a complete layman in regards to programming. However, I have a keen desire to learn and so that is why I'm here!

    My first question... what are the differences between C++ and VC++? I wasn't originally aware of any difference, but I have a good friend who's a professional programmer and he told me that actually, they are different - with "using namespace" being an example of one of the differences (apparently it's only used in VC++: a syntax change or something) Also, apparently VC++ doesn't compile to machine code, but rather MSIL.

    I'm really confused, I originally wanted to learn C++ to write my own games, but now I'm at a loss! The tutorial found on this website or any other I've encountered doesn't mention any contrasts between the two - and uses the command "using namespace".

    I don't actually know where this question is going ha ha, I suppose I'm trying to ask, should I find a "pure" C++ compiler, and learn to use that instead? What would a professional computer game company use? One thing my friend said was VC++ is good for learning OO progamming - (which I still don't fully understand, along with many other things!).



    Thanks for any help you may have.



    Jack

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    using namespace is completely standard C++. The basic idea: C++ is a language, VC++ is a compiler for that language made by Microsoft. There will be compiler extensions (bits that a compiler accepts that aren't part of the language) for just about any compiler (gcc has its extensions, VC++ has its extensions). "using namespace" isn't one of them.

    I have no idea about the exact process VC++ uses. I wouldn't expect MSIL to be part of the compilation process for C++ (maybe for C#), but it could happen I suppose.

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    I'm not sure what your friend has been smoking...

    C++ is a language.
    Visual C++ is a specific compiler for the C++ language.

    "using namespace" is part of the C++ language.

    VC++ compiles to machine code.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  4. #4
    Registered User
    Join Date
    Mar 2010
    Location
    Oklahoma City, OK USA
    Posts
    6
    VC++ is Microsoft Visual Studio that will allow you to program in C++, but it is NOT a good learning platform just from seeing what it can do, you will need to learn normal C++ first, so that something like Visual Studio would enhance your abilities and not prevent you from knowing how to program.

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    8
    Quote Originally Posted by cpjust View Post
    I'm not sure what your friend has been smoking...

    C++ is a language.
    Visual C++ is a specific compiler for the C++ language.

    "using namespace" is part of the C++ language.

    VC++ compiles to machine code.

    Ha ha, he gave up smoking a while back...

    But anyway, after speaking to my friend again, and finding out some stuff on the internet, actually they ARE different. As one person said:

    "So if you want to learn C++, you have two choices: Learn C++/CLI, which limits you to a MS-only language which yes, generates MSIL instead of native machine code, and requires .NET to run, and generally isn't worth the bother because if you're going to take a dependency on .NET anyway, why not write in C#?"

    Also, bearing in mind C++ is 20+ years-old, and so before OO, and therefore before namespaces.

    Anyway, I seem to have found what I was looking for, but thanks for the help.
    Last edited by #include Jack; 03-28-2010 at 11:12 AM.

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by #include Jack View Post

    "So if you want to learn C++, you have two choices: Learn C++/CLI, which limits you to a MS-only language which yes, generates MSIL instead of native machine code, and requires .NET to run, and generally isn't worth the bother because if you're going to take a dependency on .NET anyway, why not write in C#?"
    C++/CLI is your VC++. And then, for that matter, what was your second choice?

    EDIT: Found the original here. And I think that's a pretty good answer.

    EDIT EDIT: I was ignoring the bit about namespaces, because anyone who actually believes what you typed is beyond saving, but for the record: no C++ is not "before namespaces".
    Last edited by tabstop; 03-28-2010 at 11:38 AM.

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by #include Jack
    But anyway, after speaking to my friend again, and finding out some stuff on the internet, actually they ARE different. As one person said:

    "So if you want to learn C++, you have two choices: Learn C++/CLI, which limits you to a MS-only language which yes, generates MSIL instead of native machine code, and requires .NET to run
    You need to make up your mind whether you are talking about "VC++" or C++/CLI The trouble is that "VC++" is not very specific: maybe you're talking about a Microsoft compiler for C++ (MSVC), or maybe you're talking about C++ with MSVC specific language extensions, or as it turns out... maybe you're talking about C++/CLI.

    Quote Originally Posted by #include Jack
    Also, bearing in mind C++ is 20+ years-old, and so before OO, and therefore before namespaces.
    It is true that C++ is more than two decades old. It is also true that namespaces were only introduced maybe a decade after the first C++ implementation. However, as has been stated, namespaces are part of standard C++. Furthermore, the statement that C++ was invented before OO is obviously false. There is also the implication that namespaces are a consequence of OO: such an implication is also false.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by #include Jack View Post
    Ha ha, he gave up smoking a while back...

    But anyway, after speaking to my friend again, and finding out some stuff on the internet, actually they ARE different. As one person said:

    "So if you want to learn C++, you have two choices: Learn C++/CLI, which limits you to a MS-only language which yes, generates MSIL instead of native machine code, and requires .NET to run, and generally isn't worth the bother because if you're going to take a dependency on .NET anyway, why not write in C#?"

    Also, bearing in mind C++ is 20+ years-old, and so before OO, and therefore before namespaces.

    Anyway, I seem to have found what I was looking for, but thanks for the help.
    No program I've ever written with VC++ has ever needed .NET to be installed.
    You can tell it to write MSIL code instead of machine code, but I always compile to machine code.

    I don't know if namespaces were part of the original (pre-standard) C++ compiler, but they're definitely in the C++ standard. As for it being before OO, I'm pretty sure even the pre-standard C++ had classes, otherwise it would just be C.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  9. #9
    Registered User
    Join Date
    Mar 2010
    Posts
    8
    This appears to be turning into more of a debate than the help I was looking for.

    But just for the record: C++ isn't an OO language as it is known today. Any use of managed code, in any language - be it C#, VB or VC++ will compile down to MSIL.

    More is the question of when it is appropriate to use VC++, and why professional programmers in general seem to avoid the VC++ compiler.

    But as no one seems able to answer my original question, I have decided to learn assembler instead. No better way to get down to machine code, then to write with it!

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by #include Jack
    But just for the record: C++ isn't an OO language as it is known today.
    No, C++ is an OO language. Modern C++ makes use of "multi-paradigm programming", and OO is certainly one of the programming paradigms involved.

    Quote Originally Posted by #include Jack
    More is the question of when it is appropriate to use VC++, and why professional programmers in general seem to avoid the VC++ compiler.
    Until you have defined what exactly you mean by "VC++", this "question" is futile. Furthermore, I was not aware that "professional programmers in general seem to avoid the VC++ compiler".

    Quote Originally Posted by #include Jack
    But as no one seems able to answer my original question
    That is not very fair: your original question is not well specified, because as I said, "VC++" is not well defined. If you mean to compare standard C++ to C++ with Microsoft compiler extensions, then we certainly can help you (though I wonder how much good that will do when you do not even know C++ in the first place).
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Registered User
    Join Date
    Mar 2010
    Posts
    8
    I suppose the fault lies with me - it's very difficult for someone just starting to program to grasp the different concepts of C++ as there seems to be no set definitive - I'm probably making generalisations. From what I'm aware of, the original C++ wasn't OO in the sense that modern C++ is. It was not possible to write a pure OO program with it.

    As for VC++, I am simply referring to, as you put it, Microsoft's compiler extensions; the Visual Express compilers. When I said professional programmers seem to avoid it, I meant it in the sense VC++ compiles down to MSIL, or parts of it anyway - and so programmers wanting to use .NET would choose C# over VC++.

    I was being a bit sarcastic with my last remark. I think I should change my question to - what is best for a novice programmer wanting to learn sound principles and disciplines. Where should I start?

  12. #12
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Again, VC++ is usually the "name" of the Microsoft C++ compiler. That is, a compiler for C++, not C++/CLI, not VB, not C#, etc. Pure 100% C++.
    Modern C++ has evolved a lot since its original implementation, of course, but I don't see what that to do with anything. Modern C++ is a very powerful OOP language, among other things. You won't find much you can in other languages that you cannot do in C++.

    And the last question is still too vague for us to answer (given your initial question). What exactly do you want to do? Do you want to learn a specific language? Do you want to know what the best language is for a given task? That should be the first thing to answer.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by #include Jack
    I suppose the fault lies with me - it's very difficult for someone just starting to program to grasp the different concepts of C++ as there seems to be no set definitive
    No problem.

    Quote Originally Posted by #include Jack
    From what I'm aware of, the original C++ wasn't OO in the sense that modern C++ is. It was not possible to write a pure OO program with it.
    This depends on what you mean by "pure OO". OOP can be used even in C, which does not have any native support for inheritance and polymorphism. Yet, as far as I know, inheritance and polymorphism support was provided from the earliest versions of C++, so in that sense it has always been possible "to write a pure OO program with it".

    Quote Originally Posted by #include Jack
    As for VC++, I am simply referring to, as you put it, Microsoft's compiler extensions; the Visual Express compilers. When I said professional programmers seem to avoid it, I meant it in the sense VC++ compiles down to MSIL, or parts of it anyway - and so programmers wanting to use .NET would choose C# over VC++.
    You might want to read Stroustrup's answer to the FAQ What do you think of C++/CLI? Now, the compiler extensions that I was talking about are those that are of a much smaller scale: they add just a few language features, and the resulting program would not be compiled to MSIL. C++/CLI involves extending C++ on a much larger scale. Either way, there is a common base of standard C++.

    Quote Originally Posted by #include Jack
    I think I should change my question to - what is best for a novice programmer wanting to learn sound principles and disciplines. Where should I start?
    Personally, I would suggest that you start by learning Python, and then use Python to develop programming problem solving skills. On the other hand, if you are interested in learning C++, then I would suggest that you work through Glassborow's You Can Do It! or Koenig and Moo's Accelerated C++: you would learn standard C++ this way, and again use it to develop programming problem solving skills. If you want to pick up C++/CLI later, this foundation would be beneficial, while not constraining you to something too specific.

    Ultimately, it is not just about learning a programming language, but about learning how to program to solve problems (which includes things like learning about data structures and algorithms). I would not be so concerned about the nitty gritty details of language and paradigm differences before you start; once you have something, you can acquire another.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Visual C++ is a compiler, not a language.
    C++ is a language, not a compiler.

    Comparing C++ to VC++ is like comparing Apples to Apple Pies.

    And again, VC++ CAN compile to MSIL or it can compile to machine code; it just depends on what compiler settings you use.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by cpjust View Post
    And again, VC++ CAN compile to MSIL or it can compile to machine code; it just depends on what compiler settings you use.
    Honestly, I think it's better to separate that claim into languages.
    C++ compiles to native code. Period. VC++ is the compiler for C++.
    C++/CLI (another language) compiles to MSIL. Period. Another compiler in the Visual Studio toolset does this compilation. Regardless if it's the same "compiler", they're still two different languages, so no mere "setting" changes this behavior. The setting switches languages.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Tags for this Thread