Like Tree9Likes

Why not add CUDA forum?

This is a discussion on Why not add CUDA forum? within the General Discussions forums, part of the Community Boards category; Ah, I can relate on the dynamically typed bit. Still, GC brings its own cats into the bag, and bounds ...

  1. #16
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,594
    Ah, I can relate on the dynamically typed bit.
    Still, GC brings its own cats into the bag, and bounds checking is easily done with C++ too, negating those two.
    I have to agree on the third, though o_O
    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.

  2. #17
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by MK27 View Post
    The first and most obvious point would be that those languages have garbage collection and runtime bounds checking.
    You're again thinking in terms of C.

    I'd also say that C++ has warped my perpective, somewhat, so you're correct in your point of view.
    Last edited by manasij7479; 03-26-2012 at 02:24 PM.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #18
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by manasij7479 View Post
    You're again thinking in terms of C.
    No, I am thinking in terms of C++. You can easily create memory leaks in C++ by accident. If fact, if you don't attend to cleaning up, you inevitably will. You can leak memory in most GC languages one way or another as well, but it is much more of a challenge.

    Quote Originally Posted by Elysia
    bounds checking is easily done with C++ too
    What does "easily" mean? Does it mean, as easily, and with respect to all types, etc, or does it actually mean, "not as easily, and not for all purposes or in all situations".
    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

  4. #19
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,594
    Quote Originally Posted by MK27 View Post
    No, I am thinking in terms of C++. You can easily create memory leaks in C++ by accident. If fact, if you don't attend to cleaning up, you inevitably will. You can leak memory in most GC languages one way or another as well, but it is much more of a challenge.
    Slap a smart pointer onto the pointer and you're done (which type is obviously a good design question).
    That is, unless you are creating circular references. But correct me if I'm wrong, I don't think simple GC deal with that, either. You need some pretty sophisticated GC to detect and fix that.

    What does "easily" mean? Does it mean, as easily, and with respect to all types, etc, or does it actually mean, "not as easily, and not for all purposes or in all situations".
    It means the former.
    Just use std::array or std::vector and the at member function.
    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.

  5. #20
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Elysia View Post
    Slap a smart pointer onto the pointer and you're done (which type is obviously a good design question).
    Well, that is fine and dandy in so far as it means C++ is trending toward optional GC. "Optional" is the best of both worlds, but it does not equate to easier. Easier means I do not have to think about it at all. Optionally using a smart pointer means having to create an implementation or find an existing one. I realize C++11 adds something along these lines. In any case, I now have to learn how to use a smart pointer, and even once I know how, I have to actually do it, which is not easier. It is more manual effort and therefore more stuff to screw up.

    Trying to claim that is just as easy to use as built-in-from-the-beginning GC is just FALSE. I'd also note that C++ is PACKED with these kind of features that have been incorporated as options at various points in time*. That does not add up to "easy", or "uniform". It adds up to abstruse eclecticism .

    * anyone with half a brain will recognize that if someone totally redesigned C++ tomorrow without concern for backward compatibility, it would not have half the "features and options" it does now. The interface is a labyrinthine behemoth compared to any other language I've ever heard of. Again: powerful and flexible, yes. Easy? That's nuts.

    It means the former. Just use std::array or std::vector and the at member function.
    No, the former included "with respect to all types" by which I meant all containers, all compound types, etc. Not just another optional possibility (which 'at' is just an option too -- an option inside an option).

    Again, I don't think these are reasons to consider C++ a bad language. It isn't. But they are reasons to consider it a relatively difficult (as in, not easy) language to use.
    Last edited by MK27; 03-26-2012 at 03:06 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

  6. #21
    Registered User
    Join Date
    Sep 2007
    Posts
    131
    Quote Originally Posted by manasij7479 View Post
    I think C++ is rapidly becoming less recommended as a learning tool.
    I don't know why though, as it has the most 'easy' but powerful way to deal with abstractions, which programming is almost all about.
    It has a steep learning curve. I started programming back in 1982 on an Atari 400 and 400XL using basic. I eventually migrated to PCs and C.

    When C++ started to make some headway, there was heated, really hot arguments over it's value since it was merely a wrapper to C and thus slow and bloated, so I myself disregarded it.

    Jump to 2012 and I'm trying to learn it, but frankly, it's pretty damned complex. Polymorphism and anything other than simple inheritance is a stumbling block for me. I cut my teeth on C and its minimalistic structure (minimalistic with regards to C++) and it's much easier for me to apply algorithms to C than it is C++.

    As an example, look at this C++ code:

    Code:
    #include <iostream>
     
    template<typename T, typename U>
    class e
    {
        void Print() //call this function!
        {
            std::cout << "You haxxor..." << std::endl;
        }
    public:
        T g()
        {
            return&U::Print;
        }
    };
     
    struct Foo {
        static const int Print = 0;
    };
     
    int main() {
       e<void (e<int*, Foo>::*)(), e<int*, Foo> > e1;
       void (e<int*, Foo>::*ptr)() = e1.g();
       e<int*, Foo> e2;
       (e2.*ptr)();
    }
    I can't even wrap my head around:

    Code:
     e<void (e<int*, Foo>::*)(), e<int*, Foo> > e1;
    That's freaking martian.

    I do value C++ for a few features. I love operator overloading. I love being able to express vector math as simple addition, subtraction, etc, without having to do a literal function call or repeat v3.x = v1.x + v2.x, etc. Thinking of some things as objects is also valuable. However, I think many people go overboard with the OOP and start making some primitive things into objects with private data when all it serves is to make it more difficult to work with. For my geometry work, vertices and vectors are simple structs with some operator overloading. Triangles, OTOH, are objects as are the 3D objects they form.
    Last edited by Cynic; 03-26-2012 at 07:28 PM.

  7. #22
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,246
    That's freaking martian.
    That code may be martian, but it isn't semantically or logically valid C++, and it wouldn't compile with a standard compliant compiler in any event. Even the attempt to make it work with the `Foo' structure is beyond idiotic; the correct approach for any compiler for which would allow that: uninstall.

    If you want to know what it does, start a post where it could benefit others in the C++ forum proper.

    But they are reasons to consider it a relatively difficult (as in, not easy) language to use.
    It is an extremely easy language to use. Why, the majority manage to use it very well without understanding even half of it.

    I think C++ is rapidly becoming less recommended as a learning tool.
    $0.02

    The full C++ language is an awful mess.

    Does that make it hard to learn the basics?

    It doesn't. I'm convinced that the problems good students have comes from the poor lesson structure used by most.

    Look at some of the modern beginning programming guides for languages like Python. One of my favorite resources when I was starting out with Python was a series of articles written around accomplishing a specific task. Those articles didn't start with "Do this to print a message."; they didn't continue with the usual progression. Each task was designed to reveal the concept behind such facilities through an imagined dialog. There wasn't a specific chapter covering "repetition" that mechanically discusses the options for looping. The first example covered the repetition relationship between the concept and one way Python handles it by a very natural discussion of repeating the same small measures until the task is accomplished.

    It was a brilliant series of articles. You can teach C++ almost the same way. Students don't get as much experience with raw facilities, but the students don't need to learn those facilities from the beginning. Does knowing how raw pointers and manual memory management work from the beginning make students better? How could it when those things are most often used to develop high level facilities. The experience they get lets them build on concepts that are more generally useful instead of ........ing about with details only relevant to C++ which anyway is best learned after a firm understanding of general programming concepts.

    Soma

  8. #23
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Cynic View Post
    Polymorphism and anything other than simple inheritance is a stumbling block for me.
    [...]
    I think many people go overboard with the OOP and start making some primitive things into objects with private data when all it serves is to make it more difficult to work with.
    Maybe you feel this way because you have tried to approach OOP through C++, which as I was trying to say, only makes it harder compared to (probably) every other existing OO language.

    Quote Originally Posted by phantamotap
    Look at some of the modern beginning programming guides for languages like Python. [...] You can teach C++ almost the same way.
    Sure, of course. But it is still going to be harder to teach language neutral concepts in C++ than in python (well, I don't know python, but I presume it could not possibly be as arcane as C++, lol). Put another way: if you were a prof and wanted to teach OOP to students who did not yet know an OO language, you could use C++, but it would probably not be the best choice. I think a language like ruby or even java would be much better, and then once they understood, they could move on and learn C++. They might even end up as better C++ programmers by taking that route. $0.02.
    Last edited by MK27; 03-26-2012 at 08:21 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

  9. #24
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,246
    I don't know how I missed these.

    I'd also note that C++ is PACKED with these kind of features that have been incorporated as options at various points in time. That does not add up to "easy", or "uniform". It adds up to abstruse eclecticism.
    I know you aren't being entirely serious with this, but I have to say, a language that doesn't evolve is going to die.

    The interface is a labyrinthine behemoth compared to any other language I've ever heard of.
    How many people do you know who can claim that they know even most of it?

    Okay.

    How many people do you know who can put basic "OOP" and generic facilities to excellent use?

    That huge difference is because much of that labyrinth can remain safely unexplored.

    Trying to claim that is just as easy to use as built-in-from-the-beginning GC is just FALSE.
    O_o

    That's an argument almost everyone makes.

    Using existing facilities in a language with garbage collection is easy. It starts getting messy when you need to code new facilities. I know some languages actually do handle this pretty well, but that says nothing for the majority where you have to jump through a lot of hoops in an effort to get complex resource released in a timely fashion. Of course, that's only for languages where that is even possible; some languages with garbage collection have no mechanism in place to assure release in a timely fashion. For languages such as those client code has no option other than manually manipulating resource release if that release needs to be released in a timely fashion. That's an important point when discussing the virtue of garbage collection as a concept (versus a particular implementation) because client code often devolves into "C-isms" for resource that aren't memory.

    C++ is far from perfect. It does however offer a lot more control to programmers building new facilities. It has weak resources. It has smart pointers as a soft garbage collection. It has scoped resources. Using these mechanisms when already in place for existing facilities is exactly as easy as using them in any other language that requires variables be declared. Yes, it does get messy when creating a new resource but careful composition helps.

    The important part in all of this is that while using a resource through a C++ object that manages itself (sharable smart pointer) may not be "easier" it is certainly no more difficult than declaring a garbage collected variable in many languages.

    Soma

  10. #25
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,246
    Put another way: if you were a prof and wanted to teach OOP to students who did not yet know an OO language, you could use C++, but it would probably not be the best choice.
    I could teach them strong design concepts like "abstraction" and "encapsulation" in any language with which I'm familiar. I wouldn't teach them "OOP". I find that "OOP" has grown such strange arms I'm unfamiliar with it myself. I wish I was joking or being obtuse to make some stupid argument. I'm not; just a few days ago I had to argue that the notion of a "monad" in "OOP" languages like C++ was insane.

    *shrug*

    Are the students going to target a field primarily built on C++? If so, I'd teach them C++.

    I think a language like ruby or even java would be much better, and then once they understood, they could move on and learn C++. They might even end up as better C++ programmers by taking that route.
    That's a crappy way to teach anything.

    Would you recommend learning a string instrument with frets before learning one without just because it might be a little easier? No. You wouldn't. The time spent learning the details of the instrument that has frets cold be spent learning what the student wants to learn. The general music concepts that apply to both instruments can be taught regardless so why spend any effort at all on something that isn't related to what the student wants to do?

    Programming works the exact same way. Sure, you or me, or any other very experienced programmer, can start working out the details of a new language easily enough, but newbies start without the experience and even intermediate level programmers would have a harder time than is reasonable when they could have simply learned a good target language from the start.

    Soma

  11. #26
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by phantomotap View Post
    Would you recommend learning a string instrument with frets before learning one without just because it might be a little easier? No. You wouldn't. The time spent learning the details of the instrument that has frets cold be spent learning what the student wants to learn.
    Ah, but "what the student wants to learn" is an important distinction. If the student wants to learn C++, by all means the student should learn C++. That is not what the discussion was about, or at least that's not where I was coming from (see posts #11 and #13). And also 15, WRT the relative value of GC:

    Not everybody likes GC or dynamic typing, but to say that they do not make things easier, esp. for beginners, is a bit absurd. And they abstract away low level details.
    Point being, I'm not trying to argue about what language to teach someone if they want to learn to learn C++. If they want to learn C++ they should learn C++. I was just answering Manasij's bewilderment that "C++ is rapidly becoming less recommended as a learning tool" when "it has the most 'easy' but powerful way to deal with abstractions", which is just false. It does not have the most easy ways to deal with abstraction. As I said earlier, I cannot think of a language which presents more complex and difficult to learn ways of dealing with abstraction. So, WRT to "Intro to Programming 210" or whatever, it seems to me that curriculum I've looked at, mosts schools only offer one or two of those, and they are in either usually either C++ or Java (if there are two such courses, one is C and the other C++ or Java), but it does not surprise me to hear that "C++ is rapidly becoming less recommended" where there are many languages that are easier to use, even if ultimately, C++ has advantages those languages do not.

    WRT to fretted and fretless instruments, BTW, I used to play electric bass when I was a youngster, and eventually I played fretless. The normal and recommended path there is to learn fretted bass first. When I picked up a fretless bass, it was relatively easy because although the finger position is a bit forward, I a) still knew more or less where, and more importantly, b) I could hear where the intervals were a bit wrong because I was so used to hearing them correctly. Would it be easy the other way around (to pick up a fretted bass after learning on fretless)? Even more so presumably. Perhaps by analogy, I've repeatedly seen people here who's first language was C++ talk about how they like python because it is so easy to use and learn.

    But the difference is, the kid learning fretted bass is going to be playing more complex songs sooner than the kid learning fretless. Likewise, the kid who is introduced to programming via perl, python, or ruby is going to be up and running and doing more complex tish (eg, actually applying concepts like abstraction, encapsulation, inheritance, polymorphism in real projects) sooner than the kid wrestling with C++. I also said if they then move on to C++, it might make them better C++ programmers because they will not confuse the language specific means of encapsulation, inheritance, and polymorphism with the language neutral ends (which I think C++ neophytes are especially prone to do, because of the defensive and pompous culture of C++ ).

    Again, if the kid says, "NO I WANT TO LEARN FRETLESS BASS", let him or her learn fretless bass, don't throw a ukulele at them.
    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

  12. #27
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,246
    O_o

    I see. I wish you would have said this earlier. You would have saved some time. I only have time for this one game.

    Soma
    MK27 likes this.

  13. #28
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,594
    Quote Originally Posted by MK27 View Post
    ..."it has the most 'easy' but powerful way to deal with abstractions", which is just false...
    I am inclined to disagree. This is a matter of high subjectiveness. Clearly, to some, it is far easier to abstract stuff in C++ because of all the functionality it has that other languages lack (for example, private and protected inheritance is something that Java lacks).
    And to some, the less amount of features and some functionality such as garbage collection makes it far easier for something to abstract something in Java.

    ...where there are many languages that are easier to use, even if ultimately, C++ has advantages those languages do not.
    Subjective. I find C++ easier to work with than Java because of the advantages it offers.

    ...I've repeatedly seen people here who's first language was C++ talk about how they like python because it is so easy to use and learn.

    ...

    Again, if the kid says, "NO I WANT TO LEARN FRETLESS BASS", let him or her learn fretless bass, don't throw a ukulele at them.
    Again, subjective, but I think the general trend is that when you teach a newbie some language, then transition to some other, they will have more difficulty than learning the language that is transitioned to first. Mostly because they learn to think in certain ways and pick up habits that do no transfer over.
    Why do you think the people here on the forum recommend learning C++ only instead of learning C as a prerequisite to learning C++?

    Quote Originally Posted by MK27 View Post
    Sure, of course. But it is still going to be harder to teach language neutral concepts in C++ than in python (well, I don't know python, but I presume it could not possibly be as arcane as C++, lol). Put another way: if you were a prof and wanted to teach OOP to students who did not yet know an OO language, you could use C++, but it would probably not be the best choice. I think a language like ruby or even java would be much better, and then once they understood, they could move on and learn C++. They might even end up as better C++ programmers by taking that route. $0.02.
    Is this a good or bad thing? Perhaps it is harder to teach language natural constructs in C++ because C++ is too flexible and offers a lot more functionality that other languages simply do not have?
    Add to that that Java is over zealously OOP-oriented (and even requires type casts and other ugly stuff!).
    Last edited by Elysia; 03-28-2012 at 04:54 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.

  14. #29
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,698
    The only reason C++ is taught in school is probably because of the job opportunities involved. If Python were in C++'s position, well... that's a messed up thought, but then people would at least be learning python in school. I don't think what's easy to learn is really a concern for the department. They make it easy to learn whatever it is by having good professors. And 16 week courses help, at least at my school.

    Perhaps it is harder to teach language natural constructs in C++ because C++ is too flexible and offers a lot more functionality that other languages simply do not have?
    Counting the STL (and I don't know why you would), that was literally the only thing unique to C++ that I learned in a class. Of course other languages have their own library code. I don't think the STL offers anything that other languages haven't got.
    Last edited by whiteflags; 03-28-2012 at 10:06 AM.

  15. #30
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    Mmm, the last mention of the topic was post #5 a week ago.

    Carry on!
    manasij7479 likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 03-19-2009, 12:02 PM
  2. New to C and forum, need some help!
    By Icebreaker9 in forum C Programming
    Replies: 4
    Last Post: 02-10-2009, 08:45 PM
  3. General forum question - if in wrong forum...
    By ulillillia in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 05:00 AM
  4. no SDL forum ?
    By black in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 10-28-2002, 08:24 PM
  5. Replies: 7
    Last Post: 09-08-2002, 02:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21