not enjoying it

This is a discussion on not enjoying it within the General Discussions forums, part of the Community Boards category; Allow me to butt in on this discussion. abachler: you're wrong bithub: you probably should research more about exceptions You ...

  1. #46
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    Allow me to butt in on this discussion.

    abachler: you're wrong
    bithub: you probably should research more about exceptions

    You are each coming at this from a different perspective.

    bithub: abachler is coming at this from the perspective of what an exception really is. Originally, exceptions were generated by hardware when something happened that needed to be handled. This could be an I/O request, and system call, a divide-by-zero, or several other things. Recently, programming languages have expanded the definition of "exception" to include many other things. You are working off of the expanded definition of an exception, while abachler is working off of the original definition. (Hence all of his links to the Intel architecture manuals)

    abachler: you're wrong. Properly written code will generate exceptions. Just not bad exceptions Like I said above: I/O requests, system calls, and page faults (maybe the most common exception of them all) are all hardware exceptions. Of course, there are others which hopefully should not be called by correctly written code, but you never know (integer overflow, floating point error...although these exceptions might be caused purposely by the programmer). Other exceptions we can't control by code at all: hardware malfunction exceptions.
    My Website

    "Circular logic is good because it is."

  2. #47
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    bithub: abachler is coming at this from the perspective of what an exception really is. Originally, exceptions were generated by hardware when something happened that needed to be handled. This could be an I/O request, and system call, a divide-by-zero, or several other things. Recently, programming languages have expanded the definition of "exception" to include many other things. You are working off of the expanded definition of an exception, while abachler is working off of the original definition. (Hence all of his links to the Intel architecture manuals)
    I realize this. The point is that we were talking about smart pointers helping memory management when an exception is thrown. It is obvious given the context that we are talking about C++ exceptions -- not hardware exceptions. In the context of this discussion, him bringing up Intel manuals was either a complete misunderstanding of the discussion at hand, or a (unfunny) joke.
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #48
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    I didn't really read the entire thread before posting my previous response, so it might seem out of context. All I read were the last couple posts which talked completely about exceptions and not smart pointers.

    So, if I were focus my response more on the topic of pointers rather than just exception handling (as that seems to have been the topic of discussion before), then I would have to agree with abachler in that properly written code should never generate a null pointer exception...that I can think of. There may be some corner case...

    However....C++ as far as I know technically doesn't even have null pointer exceptions...that's not in the C++ feature set...so why do we care.
    Last edited by DavidP; 08-18-2009 at 03:46 PM.
    My Website

    "Circular logic is good because it is."

  4. #49
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by bithub View Post
    In the context of this discussion, him bringing up Intel manuals was either a complete misunderstanding of the discussion at hand, or a (unfunny) joke.
    Actually I vote typical rhetorical ploy. When you know you are wrong, it is still possible to conceal the fact from some people by throwing chaff.
    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. #50
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    I didn't really read the entire thread before posting my previous response
    You need to read back a few more posts then

    He was responding to this point I made: "How do you easily write exception safe code without smart pointers?"

    His response was, "Properly written code will not generate exceptions because it will check before it tries to access null pointers..." which makes absolutely no sense.

    This entire derail started when he claimed that only "noobs" need to use smart pointers. I (obviously) disagree with that assertion.
    bit∙hub [bit-huhb] n. A source and destination for information.

  6. #51
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    I find it fascinating that some of the best minds in the C++ development world are noobs and abachler is not. Now, if someone could please point me to Abachler published papers...

    I can only find names like Alexandrescu, Meyers, Colvin, Stroustrup, Sutter, etc.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #52
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    Funny discussion
    I'll be using smart pointers for a looong time.

  8. #53
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    It's absolutely possible to maintain a larger system without smart pointers. I'm maintaining a 6024 Files Sourcecode (project and resource files not included) project which doesn't have a single smart pointer. It's using WinAPI (actually, it's using MFC urghs...) and Abachler has a point, if you are working in a Windows environment, it's enough. No one will pay me for making it portable because the infrastructure is Windows only and if we ever switch to something else, software will surely be the least of our problems.

    However, boost does bring some nice things to the table. RegEx for example. How do you use regular expressions with pure WinAPI?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  9. #54
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    He has a point in saying there may not be a need for smart pointers. He even has a point in saying, ultimately you can go by without smart pointers (assuming you don't use exceptions). He doesn't have a point when saying only noobs use smart pointers.

    Smart pointers are a design pattern. They answer to specific use cases. The idea that an abstraction meant to simplify code, make it safer and even bringing some nice touches to the table like value semantics to pointer-like objects can be discussed in terms of user experience is ridiculous and a show of... you guessed it, noobness.

    By the same account we can just ignore every other single abstraction in code design. We should ignore the whole of the GoF and god forbid you use the STL. There's no need for any of that. Only noobs try to simplify their code. Expert programmers do it like a man!
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  10. #55
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,165
    "It's using WinAPI (actually, it's using MFC urghs...) and Abachler has a point, if you are working in a Windows environment, it's enough."

    Strangely enough the MFC classes encapsulate resource management of virtually every Windows API object in exactly the same way a "smart pointer" manages memory resources. Do you manually `CFile::Close' every `CFile' and `CGdiObject:eleteObject' every `CBitmap'?

    Or `std::fstream::close' every `std::fstream'?

    Some

  11. #56
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    Quote Originally Posted by nvoigt View Post
    It's absolutely possible to maintain a larger system without smart pointers. I'm maintaining a 6024 Files Sourcecode (project and resource files not included) project which doesn't have a single smart pointer. It's using WinAPI (actually, it's using MFC urghs...) and Abachler has a point, if you are working in a Windows environment, it's enough. No one will pay me for making it portable because the infrastructure is Windows only and if we ever switch to something else, software will surely be the least of our problems.

    However, boost does bring some nice things to the table. RegEx for example. How do you use regular expressions with pure WinAPI?
    it doesnt matter really. The discussion started as if boost and Win32 API would rule each other out and they just dont. You cant say, hey I use Win32 so I dont need boost

  12. #57
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    Quote Originally Posted by KIBO View Post
    You cant say, hey I use Win32 so I dont need boost
    Still, I insist, there are cases and cases. You don't want to use some boost libraries with the WinAPI. Heck, You don't even want to use some of the STL containers depending on your efficiency and performance requirements.

    You can do it certainly. But since the WinAPI encapsulates it's own types and their semantics that are not STL based, bringing in boost might unnecessarily complicate your code and provide little to no benefit. This is where I agree with abachler. Not on the noob nonsense.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  13. #58
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Quote Originally Posted by phantomotap View Post
    "It's using WinAPI (actually, it's using MFC urghs...) and Abachler has a point, if you are working in a Windows environment, it's enough."

    Strangely enough the MFC classes encapsulate resource management of virtually every Windows API object in exactly the same way a "smart pointer" manages memory resources. Do you manually `CFile::Close' every `CFile' and `CGdiObject:eleteObject' every `CBitmap'?

    Or `std::fstream::close' every `std::fstream'?

    Some
    Matter of fact, yes, we do. I explicitly close all my files, no matter what class.

    it doesnt matter really. The discussion started as if boost and Win32 API would rule each other out and they just dont. You cant say, hey I use Win32 so I dont need boost
    It always depends on your project. For that specific project I can say that since we use MFC, we don't need boost (or the stl even). It has nothing we could use that hasn't been implemented as part of the MFC. For other projects, there may be parts of boost that have no equivalent in the WinAPI (like RegEx). As a general statement, one cannot say that boost is not bringing anything to the table. But for a specific project, this might be the case.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  14. #59
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,403
    Moderator note:
    Parts of this thread was moved to: Exceptions and Interrupts.
    Last edited by laserlight; 08-21-2009 at 05:44 AM.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 4 of 4 FirstFirst 1234
Popular pages Recent additions subscribe to a feed

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