Slashdot Mirror


User: jungd

jungd's activity in the archive.

Stories
0
Comments
133
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 133

  1. Re:Asking the wrong question? on What Good Linux Debuggers Are There? · · Score: 1

    PS: You are right though - that if you don't use a garbage collector, if a smart-ptr is just reporting leaks - they are still leaks. That is why I use a garbage collector.

  2. Re:Asking the wrong question? on What Good Linux Debuggers Are There? · · Score: 1

    Memory leaks are *not* generally statically detectable. That is, you cannot detect them at compile time.

    But you *can* make it impossible to write code that leaks - at compile time.

    Your compiler can enforce correct use of a smart-ptr - one which also manages storage either by reporting memory that was not manually reclaimed, or just automatically reclaiming it (garbage collection) - or both. If you use a garbage collector (either to reclaim all storage or just to get what you missed) then your code will not leak unless there is a bug in the collector or smart-ptr code.

    There are also garbage collection techniques for C++ that work fine with C pointers and malloc/free - although I don't use them. They typically don't provide all the other type safety benefits of the smart-ptr approach.

  3. Re:Asking the wrong question? on What Good Linux Debuggers Are There? · · Score: 3, Interesting
    Either that or you're not doing serious C++ development, or you're a manager that doesn't write code.

    Yes, I've been doing serious C++ programming for years (of varying degrees of seriousness :). I am not a manager.

    My team uses everything you mention, with the addition of some other stuff like automatic memory leak detection and OS-level hooks to detectI...

    You won't need automatic memory leak detection if you make it *impossible* to program.

    While these techniques and tools are great, even with great programming practices there's no way you can eliminate all bugs this way. People make mistakes.

    Yes, people make mistakes - that is what the compiler is for (for the most part - of course I'm not claiming it can get *everything*)

    So when you're in the initial stages of development you're meaning to tell me that neither you nor anybody on your team makes a mistake where you end up dereferencing a NULL pointer?

    Correct. The smart-ptr class we use doesn't allow any such thing. Why on earth would you want to allow the concept of pointing to nothing? - it doesn't even make sense. Change your smart-ptr class to not allow initialization or assigmnent from anything but another smart-ptr. The constructor can construct new instances too, so it is impossible to have a pointer point to anything but a valid object. Our smart-ptr also checks the validity of the address with our memory management system before any dereference too - just in case it gets corrupted via some other mechanism - but that is very very rare.

    What about when another component or library crashes or returns an unexpected result; don't you investigate? What about subtle logic flaws that become readily apparent when stepping through the code with a debugger? You can't log everything.

    I admit we typically either have developed all the code in the system (save OS calls), or have control over the source of other libraries - so we can apply the same techniques to them. Not everyone can have that control.

    Check out Andrei Alexandrescu's book on modern C++ design for a half-decient smart-ptr class to use as a starting point.

  4. Asking the wrong question? on What Good Linux Debuggers Are There? · · Score: 3, Insightful

    It seems that the choices for debuggers under Linux are a bit lacking.

    I hate to remember how many hours I've spend using source debuggers - chasing down long call stacks, getting confused about just what was gong on.

    Now however, I haven't used a debugger at all in the last 10 years, under either Windows or Linux. The difference? - Modern software engineering practice.

    Although there are doubtless legitimate cases where a debugger is very useful; my opinion is that for any decient sized C++ codes, the application of a handful of coding techniques is a much better substitute.

    If you're chasing memory problems, use a suitable (zero cost) templated smart pointer implementation - so you can't even compile code that would corrupt memory. Similarly, apropriate abstraction classes for synchonization can also provide all the logging information you'll need to chase down synchnonization issues in parallel codes - and will help avoiding many of them in the first place (research has come a long way since the days of using error-prone primitive semaphores in high-level code).

    I suggest also liberal use of assertions (preconditions, postconditions, invariances) and multi-level logging.

    In my experience, with these tools, bad code that would cause memory corruptions or synthronization deadlocks or race-conditions will just not compile. Any that aren't caught are usually easily seen with the logging output or assertions.

    Hope my suggestions help - even though I didn't address your question. If you want to read more, pickup some books on modern generic programming in C++ and a couple software engineering texts.

  5. Re:Ecosystem / Enviromental news on African Bees Devastated by Mutant Clone Bees · · Score: 1

    This is an unfortunately typical ignorance of how sophisticated other animals are.

    All mammals - including rotents - have an emotional life identical with yours. Rodents in particular, being a highly social species, have notions of fairness and loyalty etc. much stronger than your own.

    So, no, they don't sit around contemplating human migration, but they still hurt and think it's not fair when they are forcefully displaced.

    You forget that you are an animal not much different from other mammals.

    You've been watching yoo much sci-fi TV if you think that genes and the protiens they code for can 'hard-wire' behavior.

    (The study of intelligent behavior is part of my job)

  6. Right handed sugar? on FDA Approves More Powerful Sugar Substitute · · Score: 2, Interesting

    What ever happened to right-handed sugar?
    (or do I have is backward - is regular sugar left or right handed?)

  7. Re:This is not realistic on First Reviews of Mozilla 1.0 Roll In · · Score: 1

    Perhaps, Mozilla should recognize the IE'isms and popup a dialog saying 'This web-page doesn't conform to the W3C standard for Web pages. Would you like me to attempt to emulate Microsofts proprietary format?'

    Eventually, too many web-site maintainers would get sick of users complaining about getting the pop-up (if AOL switches to Mozilla) and the web-sites might get fixed.

  8. pictures? on Jade Mother Lode Found in Guatemala · · Score: 1

    anyone? (of school-bus sized 'bits' of jade)

  9. Re:Not Popular on E3 Doom III Preview · · Score: 1

    Here here.

    I've been waiting and waiting for a decent shooter to work out my GeForce4. I bought QuakeX for the graphics and that's what I'm waiting for DoomIII for. However, The 'blood sport' doesn't interest me much. DoomIII is starting to look so unpleasant that I may even consider NOT buying it. Perhaps I'll wait for a 3rd party game using the same engine that can wow me with the 3D graphics without making me feel bad too.

    This stuff has real effects on your brain! (I'm not kidding!).

    (ok, nod me down now.)

  10. Re:No way on Molten Core Inside The Moon? · · Score: 1

    How does one get a molten core from just a rock?

    The molten core of the earch IS rock - molten rock! i.e. that stuff you see coming out of a volcano is very hot, and hence liquid, ROCK. That comprises the major part of the earth's mass.

  11. Re:Aren't there easier tests? on Molten Core Inside The Moon? · · Score: 1

    I think the poster meant the rotation of the core within the crust (which would produce a field) - not that of the moon around the earth.

  12. Re:Most Notable Improvements - export? on GCC 3.1 Released · · Score: 2, Interesting

    Does it implement export yet?
    I doubt it.

  13. ANSI Conformant? on OpenWatcom C++ Compiler Code Finally Released · · Score: 1

    How does it compare to gcc? kcc?
    export keyword?

  14. Re:Longevity is all well and good... on No Cap On Life Expectancy? · · Score: 1

    I am sore most of the time from the amount of exercise I get every day (exercise soreness is the only soreness that feels good). I am determined to keep old age at bay as long as I can.

    You realize that 'old age' isn't really a disease - old people die of something. Usually that something is an indirect result of your cells just wearing out (either evolved or just a side-effect). Your cells burn oxygen. The more they burn the quicker they die. Hence, if you over excercise too much you'll shorten your life!

    Of course the effect is probably outweighed by the many benefits of excercise. The point is, there is no magic bullet for health - not even excercise.

  15. Re:Advice from an STL battle-scarred veteran on Downsides to the C++ STL? · · Score: 1

    Secondly: Be very, very careful about using pointers to dynamically allocated objects. If you are copying pointers around, you could very easily get into a dangling reference. A smart-pointer template (which SHOULD have been part of the STL) is a handy thing to have.

    The dangling pointer problem is hardly anything to do with STL. You should be careful with pointers always. Also the STL DOES include a smart pointer template class - called auto_ptr. Of course a reference counted version like boost.org's shared_ptr would have been nice. I believe adding garbage collection to C++ and/or STL is being considered (a far superior option to using referenced counted pointers without language support IMHO).

  16. Re:STL downsides on Downsides to the C++ STL? · · Score: 1

    If you're seeing this type of bloat, it's more likely to be either a compiler problem or a really bad implementation of the STL.

    Typically a container like list is just an inlined and statically checked 'wrapper' for a more basic list that specializes on void*, or something like that. That way there should only be one set of code emitted for all lists of pointers used.

  17. Re:Help! on Red Hat 7.3 Coming Along · · Score: 1

    * Don't forget to let us know if you manage to contact her! *

  18. Re:Not the first $600K NASA dumped down this ratho on NASA Still Trying to Verify Anti-Gravity Claims · · Score: 1

    At most govt. labs a staff research costs on the order of $300,000 per year (for wages and a typically huge lab overhead - the wages are usually not bad, but not great either). That doesn't include any equipment costs.

    So for 2.6mil, you'd get a $600K machine, plus 3 full time staff members for two years.

  19. Re:really stupid requirements on What Makes a Powerful Programming Language? · · Score: 1

    What if the constructors are inlined, and the compiler can 'see' that there are no side effects.
    (btw. I wasn't talking of the construction of r, but of the return value)?

  20. Re:Von Neumann Architecture Can't Do It. on Arguing A.I. · · Score: 1

    I think you miss the point when going into how current NNs are simplifications etc. In my job I model Neurons and neural nets using computers - in much greater detail than traditional computer-science type models. They *can* be modeled in enough detail to capture all the relevent features of importance to intelligence.
    Read the literature.

    As for "hopelessly optimistic and underinformed AI advocates", I am an AI researcher by profession - as a scientist. I think you are the one who is underinformed. Faith has nothing to do with it - it is science.

    The human brain is not some big mystery that is poorly understood. It *is* understood in principle. Unfortunetly, we don't have the technology to flesh out the details. Similarly, we don't have the technology to implement intelligent systems. That *doesn't* mean we don't know how to do it in principle. No new fundamental knowledge about intelligence is needed - just an advance in engineering.
    It is only religion and 'faith' type beliefs that lead people to want some mystery - like implicating quantum superposition in conciousness and other such pseudoscience.

  21. Good! on Are SPAM Blacklists Unreasonable? · · Score: 1

    All I can say is, I'm glad you're listed. Even if you've never been a relay, the potential is there for it to happen one day. I'm sure a few SPAMs could get through before you noticed and closed the hole. Perhaps that is the case with most SPAM?

    I don't think you should be removed. If more admins knew this was the case, perhaps less would risk leaving an open mail relay in the first place. Any negative impact on the amount of SPAM moving around is good in my opinion.

  22. Misrepresented on Violent Video Game Protection Act · · Score: 1

    The story submission says "indications that video games don't cause violence."

    That is an obvious misrepresentation of the link. They say that it is inconclusive - that means it doesn't lend support to any hypothesis, one way or the other.

    I like playing Q3A etc. as much as the next guy, but it would seem pretty obvious to me that this kind of violence in games and on TV can't help but contribute to violent behavior. Like the link says - there is no one cause - but everything adds up!

    I know I am a lot less shocked when I see a shooting or other violent crime depicted on TV now (i.e. not at all), that I was when I first started seeying this kind of thing at age 18. (Australia has - or used to have - much less violence on TV than the US. In addition I lived in the country and never saw a movie or much TV until moving to the city).

  23. Re:and then there was Advertising WITHIN programs. on Networks and Studios Against PVRs · · Score: 1

    The worst of the two evils? Why I'd like to pay for my content without ads please!
    Wait a minute - *I am already paying for my content!*

    Before moving to the US a few years back I was looking forward to having cable and so-many-channels. Imagine how pissed off I was when I discovered that they had adversiting! - what the hell am I paying for then!
    To make matters worse, much of the programming seems to be focued on sensationalism etc. just trying to hold my attention between the ads!
    i.e. most programming is just ad filler!!!
    (e.g. why doesn't discovery have many actualy documentaries, instead of all these bullshit shows about sharks, fires, floods, earthquakes, snakes, voilent crime, etc. etc. that really tell me nothing)

  24. Re:really stupid requirements on What Makes a Powerful Programming Language? · · Score: 1

    If we had:

    Matrix operator+(const Matrix& m1, Matrix& m2)
    { Matrix r(m1); return r += m2; }

    Then are you meaning the construction/destruction of r when using
    a = b + c ??
    (The compiler is smart enough to eliminate the contruction of a temporary for return in this case)

    If so, how is that different from the construction/destruction involved in

    a = Matrix.add(b,c);

    if

    Matrix Matrix::add(const Matrix& m1, Matrix& m2)
    { Matrix r(m1); return r += m2; }

    ??

  25. Re:Why use hardware? on Learning Autonomic Robots · · Score: 1

    I couldn't find the link to their old robotic ecosystems projects, but here here is a link to their newer combo hardware/software system for language accusition through seeing. (click 'talking heads)