Thread: Is Visual Studio C or C++

  1. #61
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by brewbuck View Post
    And anyway, Linus isn't even Swedish.
    He is Finnish, but he is part of the Swedish speaking minority. Which leads to the inevitable question of whether his nationality == his racial identity == his cultural identity.

    He could be like me, an English speaking Welsh/German/Tsalagi American.

  2. #62
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Also disappointed to note that Tove T. is no longer involved in the martial arts. I guess she just had to give it up for the man! Ouch!

    @abachler: of course, every self respecting N. American beyond first generation is like 1/8 squaw, and proud of it!
    Last edited by MK27; 09-14-2009 at 08:38 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #63
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by MK27 View Post
    Also disappointed to note that Tove T. is no longer involved in the martial arts. I guess she just had to give it up for the man! Ouch!

    @abachler: of course, every self respecting N. American beyond first generation is like 1/8 squaw, and proud of it!
    Actually squaw is a very pejorative term (more offensive than the C word) that is generally frowned upon, as I was informed by my (now ex) wife who was 1/2 Tsalagi 1/2 French.

  4. #64
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by abachler View Post
    Actually squaw is a very pejorative term (more offensive than the C word) that is generally frowned upon, as I was informed by my (now ex) wife who was 1/2 Tsalagi 1/2 French.
    Agreed, just a very nasty attempt to imply that yer great gramma may not have been perfectly happy with the arrangement (but heck, who is?)

    I make the same joke about my mom's (English) ancestors in relation to my seafaring dad (Danish), but to the effect that she's charmed anyway, and usually no one is that amused after they finish laughing. I totally like "native people". I have a mohawk, even.

    Sorry.
    Last edited by MK27; 09-14-2009 at 08:53 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #65
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by abachler
    I wouldn't want to use pure C++ any more than I would want to use pure C.
    (...)
    Do I want to write an application without being able to use classes? No.
    Do I want to have to write my entire application using nothing but classes? Hell No.

    I use Functional/Procedural programming just like I use C/C++. Neither one can exclusively solve every problem in every domain and many solutions are both more intuitive and elegant when using both.
    Just checking, but what do you mean by "pure C++"? When I think of "pure C++" in terms of language and libraries, I think of C++ without any language extensions, but possibly including non-standard libraries written in a "pure C++" style. In terms of "pure C++" style, I think of "multiparadigm programming", where the choice (which could be a mix) of procedural, object oriented, functional and generic programming is made as is appropriate to the situation.
    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

  6. #66
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by laserlight View Post
    Just checking, but what do you mean by "pure C++"? When I think of "pure C++" in terms of language and libraries, I think of C++ without any language extensions, but possibly including non-standard libraries written in a "pure C++" style. In terms of "pure C++" style, I think of "multiparadigm programming", where the choice (which could be a mix) of procedural, object oriented, functional and generic programming is made as is appropriate to the situation.
    I thought he meant only the ++ side of the language without using any of the C functions.
    "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

  7. #67
    Registered User
    Join Date
    Aug 2009
    Posts
    198
    That's the way I got it, too.

  8. #68
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by cpjust
    I thought he meant only the ++ side of the language without using any of the C functions.
    Quote Originally Posted by MTK
    That's the way I got it, too.
    I suggest that you read this article (PDF document) by Stroustrup that explains Why C++ is not just an Object Oriented Programming Language.
    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

  9. #69
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by MK27 View Post
    Vis. the kernel team's attitude, I get the message that there will be NO TRADE-OFFS in the speed vs. ease department. Like none. Zip. Zero. Absolute priority. It is not like the kernel is just another app. They all depend upon it. So you stick with C, since you may be able to do it another way and come "close enough", but your chances of improving performance are nil. Zip. Zero. Also there's that maintainability/portability issue, tho IMO "maintainability" is probably much more subjective than most programmers want to let on.
    I don't know how many times we have to bust this myth. This is untrue, false and utter nonsense.
    This is a typical thing that C programmers often argue, that C++ is slower. That's not true. C++ can be slower in some instances, true, but so can C. Take the function pointers as an example. In C++, we could pass a function object instead of a function pointer, and it's actually proven to be faster.
    Then there's generic code in C. Since you loose all type information, you usually have to do runtime checks to find out what it is. In C++, you don't, because the compiler keeps track of the type all the way.

    Furthermore, C developers often roll out there own code for many things such as memory management. In C++, we already have facilities for these things and often they are more effective than the C counterparts! This is imply because this standard code has been written by professionals and profiled time and time again.
    In a kernel, I might agree that C++ standard library functions might be problematic because they may not be fast enough, but they could still roll out their own solutions, which wouldn't be worse than the C solution, either.

    C is not faster than C++ and C++ is not faster than C. However, some things can be slower in either C or C++, both have advantages and disadvantages.
    So the zero speed penalty is just an excuse. They simply don't want to use or try C++. That's all.
    Also, no one is going to rewrite an entire kernel in another language unless there were serious advantages with doing so, and C++ doesn't give enough of those benefits.
    Last edited by Elysia; 09-15-2009 at 07:09 AM.
    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.

  10. #70
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by Elysia View Post
    Also, no one is going to rewrite an entire kernel in another language unless there were serious advantages with doing so, and C++ doesn't give enough of those benefits.
    And the nature of the kernel doesn't lend itself to efficient implementation in C++. Also not to put too fine a point on it, but with respect to kernels, C++ is not pragmatically portable as not every processor family has a C++ compiler in it's toolchain.

  11. #71
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No, I don't think it's that the kernel's nature doesn't lend itself to C++, it's more like current kernels are not written with C++ in mind. Symbian is an OS written in C++, and I have no doubt a kernel can be, too. It might just be a different way of approaching the problem. That is what I think.
    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.

  12. #72
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Quote Originally Posted by Elysia View Post
    I don't know how many times we have to bust this myth. This is untrue, false and utter nonsense.
    This is a typical thing that C programmers often argue, that C++ is slower. That's not true. C++ can be slower in some instances, true, but so can C. Take the function pointers as an example. In C++, we could pass a function object instead of a function pointer, and it's actually proven to be faster.
    Would you care to find some proof of this? I seriously doubt that making a deep copy of an object is going to be any faster than dereferencing some pointer, so you must be referring to calling a member function via a reference to an object. This, too, is a pretty weak argument.

    If you're calling a member function in C++, you know its name. So the equivalent in C would probably be calling, e.g.
    Code:
    void something_print(struct Something *something) {}
    You only need function pointers when you don't know exactly which function you're going to call; when, for example, you're setting up callbacks or simulating inheritance. This corresponds, in C++, to overloaded functions. And in C++, you have the same sort of action: you have to look at the vtable to decide exactly which function to call. I'm sure this is comparable in efficiency to dereferencing a function pointer.

    Then there's generic code in C. Since you loose all type information, you usually have to do runtime checks to find out what it is. In C++, you don't, because the compiler keeps track of the type all the way.
    I agree that it's easier to write more generic code in C++, but usually the compiler doesn't have to make runtime checks because it generates different versions of the same code (for overloading, or templates, for instance). Unless I'm forgetting something here?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  13. #73
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Elysia View Post
    No, I don't think it's that the kernel's nature doesn't lend itself to C++, it's more like current kernels are not written with C++ in mind. Symbian is an OS written in C++, and I have no doubt a kernel can be, too. It might just be a different way of approaching the problem. That is what I think.
    You are probably right, but the fact that Symbian is written in C++ is not "evidence" one way or the other; the context is not related.

    People have written operating systems in perl, .NET, and python, but for obvious reasons, it would ridiculous to write a kernel that way. Or maybe not, since AFAICT those OS's used a custom kernel with interpreters built into them.

    Anyway, I would guess for certain a kernel could be written in any compiled language. Why not? Of course, some person(s) would have to actually do it, and that person would have to choose a language, and the "logical" choice would probably be whatever that person prefers.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  14. #74
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by Elysia View Post
    No, I don't think it's that the kernel's nature doesn't lend itself to C++, it's more like current kernels are not written with C++ in mind. Symbian is an OS written in C++, and I have no doubt a kernel can be, too. It might just be a different way of approaching the problem. That is what I think.
    I agree it can be done (I've done it). I guess I should have said, the Linux kernel does nto lend itself to being well written in C++. Mostly because of the portability issue but also because of the design choices made during its development. Could you write the thread scheduler as a class, sure, but why would you rewrite a piece of code that is already optimized and functional unless you could squeeze extra performance out of it. If you make each thread an object then the assumption is you will dynamically allocate the objects rather than simply have a predefined array for thread entries. Which entails an extra pointer calculation as you index into the array of thread objects, and then have to index into the object to retrieve the actual information. I think its instances like this that the C programmers are talking about. Is an extra index that computationally expensive? Not really. Can it be done, yes, does it reduce performance at all, yes it does. Does the fact that it reduces performance, however minuscule the amount, conflict with their policy of absolute speed above all other considerations, definitely. You are talking about an area of the system that can bog down everything. If a solution in C++ was somehow faster than the best possible solution in C, then I'm sure they would (grudgingly) accept and use it. The primary reason for the stonewalling of C++ on items where it is just as fast, but no faster is the correct assertion that once they let C++ programmers in it creates design requirements that are not easy to remove. C is also much closer to the hardware than C++. Most language features in C translate directly into a single assembly instruction, while C++ features do not.
    Last edited by abachler; 09-15-2009 at 01:13 PM.

  15. #75
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by dwks
    Would you care to find some proof of this? I seriously doubt that making a deep copy of an object is going to be any faster than dereferencing some pointer, so you must be referring to calling a member function via a reference to an object.
    The canonical case of what Elysia is talking about is the passing of a function object as a predicate to std::sort, as opposed to passing a function pointer as a predicate for qsort. The function object is cheap to copy since it usually does not even have any member variables, thus there is no penalty in doing a deep copy. However, apparently the compiler is able to perform optimisations with the function object that it cannot do with a function pointer.
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. LDAP Query
    By Travoiz in forum C++ Programming
    Replies: 0
    Last Post: 08-13-2009, 02:58 PM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM