Slashdot Mirror


User: agbinfo

agbinfo's activity in the archive.

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

Comments · 300

  1. Re:No, Wait... on Jammie Thomas Hit With $1.5 Million Verdict · · Score: 1
  2. Re:No, Wait... on Jammie Thomas Hit With $1.5 Million Verdict · · Score: 1

    I thought it was "FileNotFound" or is that just for booleans.

  3. Re:Does it work ? on How Not To Design a Protocol · · Score: 1

    For most purposes, smart pointers will do the job real fine. There's none to little overhead and you get the advantage that you know when your objects get destroyed.

    Well, again, what do you mean? If we're talking about std::auto_ptr -- that is, a refcounting pointer -- then while I haven't done the benchmarks to back it up, I'd guess refcounting can actually be worse than GC in terms of performance. In particular, with a garbage-collected language, the garbage collector presumably runs at intervals, and is highly optimized -- the whole thing probably fits in cache. This means when the GC isn't running, there's no memory-management-related code running. By contrast, with refcounting, you're at least dealing with the reference count all the time, and you're making calls to delete or free more often...

    On the other hand,

    First off, I'm not an expert in memory management. I graduated in the 90s and I'm sure things have changed quite a bit since then. That is, I may be wrong and you can prefix everyone of the next sentences with "As far as I know."

    Reference counting has very little overhead. Memory wise it adds a few bytes and time wise, it adds almost nothing as well. A GC will probably use reference counting to speed up detection of unused memory and only perform mark-and-sweep or whatever is needed to resolve circular references after that. I'm pretty sure that there's just as much, if not more, memory-management related code in a GC based program even when the GC is not running. I haven't done any benchmarks either.

    auto_ptr is probably not the smart pointer you want to use. You're better off using boost's smart pointers. The problem with auto_ptr is that they don't play along nicely with containers.

    As far as keeping unused objects in memory for cache, I don't think that GCs can do that. Once the object is no longer referenced, its data is meaningless. Also, I'm pretty sure that malloc/new implementations have never resulted in systematic calls to the OS.

  4. Re:Does it work ? on How Not To Design a Protocol · · Score: 1

    It's not that complicated.

    In theory, it's simple. In practice, not so much -- the bugs which can happen here are numerous and subtle.

    That's true. It's also true of other languages but there are probably more issues with C and C++ than there are with many other languages.

    There are also plenty of GC libraries for C++

    And my point here was that by the time you use a GC library, why not get the full benefit of a safer, saner language? You've already got most of the overhead of something like Java, why not also get the runtime optimizations and the protection from buffer overflows and segfaults, too?

    For most purposes, smart pointers will do the job real fine. There's none to little overhead and you get the advantage that you know when your objects get destroyed.

    it's possible to select which objects are GC candidates and which are not

    And what'd be the criteria for which objects should be GC'd and which you want to handle yourself?

    I'd guess the objects which you want to manage yourself are either places where you're interacting with code, or particularly performance-critical parts of your application. But if you're doing it that way, it seems to me that I get most of the same benefit by coding in Ruby, and dropping down to C for those two cases.

    It seems you could get similar benefits in Java if JNI wasn't such a bitch -- and even as it is, it isn't that bad compared to pretty much anything else in C.

    I've never had to use a GC in C++ so I'm mostly guessing here. One situation where I'd want to use GC is if I had several containers sharing the same objects and none could be considered the owner. If there's an owner, then using a weak pointers for other containers does the trick.

    As far as performance is concerned, going from managed to unmanaged code was relatively expensive in Java with JNI when I used it. Hopefully Ruby is better at it. I don't think you're wrong in that the vast majority of cases don't need the performance provided by C++.

    There's another thing you might want to look at when talking about performance. C and C++ will usually have much lower memory requirement and there's no interpreter to load. If performance is an issue, it might be simpler to stick to C++

    I just don't think the memory leak issues in C++ are as bad as many people try to make them to be.

    I don't think they're particularly bad either, but I don't see any reason I, as a programmer, should have to deal with them. I certainly don't think C++ has any real place in web development -- except, as I mentioned, in particularly performance-critical bits, especially when they can be abstracted into libraries. I trust the HTTP parser in nginx or Apache a lot more than any code I wrote myself, but anything I write, I trust a lot more in Ruby or JavaScript than in C or C++.

    If performance is not an issue, I wouldn't use C++ either unless there's some reason to. I've implemented some proof-of-concept in C++ but I did so because I had to interface with our code base. At other times I've used Perl, Java and C# when I could choose.

  5. Re:Does it work ? on How Not To Design a Protocol · · Score: 1

    BTW, I'd like to make it clear that I'm just stating a personal opinion. I'm not an expert on the subject. I'm just some guy with an opinion.

  6. Re:Does it work ? on How Not To Design a Protocol · · Score: 1

    By contrast, it's trivially easy to leak memory in a non-garbage-collected language, and again, "smart pointers" (just refcounting, right?) are still more likely to leak memory, and potentially add even more overhead than real GC.

    There are ref counting smart pointers but there's also weak pointers and unique pointers. For the majority of stuff you just want to ensure that the resource is released when the resource's owner goes out of scope. It's not that complicated.

    There are also plenty of GC libraries for C++ so it's possible to select which objects are GC candidates and which are not - best of both worlds.

    So, may as well just use GC, and if you're doing that, may as well just use something like Java. (Though not, I'd hope, Java itself.)

    GCs have other issues aside from efficiency. They make it much harder to have real-time guarantees. They make it harder to free up resources in a deterministic manner although C#'s using statement makes this much easier. Also a good number of Java and C# programmers probably don't even know about weak pointers so I'm pretty sure memory leaks exists in most non-trivial programs in GC languages too.

    Sometimes I prefer Java or C#. Sometimes I prefer C++. I just don't think the memory leak issues in C++ are as bad as many people try to make them to be.

  7. Re:Does it work ? on How Not To Design a Protocol · · Score: 1

    I believe the parent was referring to smart pointers and RAII which lets you select when the data is considered garbage and when it should be collected. Languages that use GC can also leak memory if you're not careful. I remember a Java program I was working on where the data was loaded in a map for quick lookup. Whenever the operator would load a new file, the map wasn't set to null and Weak pointers were not used so it leaked.

  8. Re:Nicely twisted summary on Microsoft Charging Royalties For Linux · · Score: 1

    than ANY OTHER SINGLE GROUP in the USA. Per capita, adjusted for percentage of population, yada yada.

    Read up on your history...

    No need, he's wrong. Just take the group of non-black Americans who commit more crimes, have more bastard children, have fewer college graduates, and lower literacy rates than blacks for example.

    Another group that contradicts his assertion is the group of racists that post his kind of comments.

  9. Re:Solving a different problem on Bees Beat Machines At 'Traveling Salesman' Problem · · Score: 1

    That reminds me of the time I was able to produce electricity through cold fusion but my teachers wouldn't even look at the results. If only I could remember the procedure again.

  10. Re:Evidence on Bees Beat Machines At 'Traveling Salesman' Problem · · Score: 2, Funny

    Is that similar to an aGNUstic?

  11. Re:Troll?! on President Obama To Appear On Mythbusters · · Score: 1

    So what specifically do you have a problem with? Always easier to slander other people than make actual arguments.

    I thought I was being clear but I'll try again. You say:

    FWIW, I don't have a problem with President Obama being on Mythbusters -- I mean, I think it's kind of stupid, but I'm not going to criticize him by saying he shouldn't be on a TV show or anything like that...

    So, you don't have a problem with it and you're not going to criticize... but, you think it's stupid. But you're not going to criticize and you don't have a problem with it.

    Criticize: to consider the merits and demerits of and judge accordingly

    According to Merriam Webster you are criticizing. So which is it? Did you honestly not know what the word meant? Were you trying to be funny? Were you trolling?

    But, I think that most people think there are different standards for the President versus a private citizen. I don't buy into many of the ideals of the presidency

    You don't buy into these ideal yet, you mention them as if they were valid for the argument you are about to make. So which is it? Do you buy into these ideals? Are you making a simple logical fallacy? Are you saying that there are some ideals you adhere to but simply forgot to mention them and we have to guess? Are you trolling?

    , but the president is supposed to be above partisanship, be a leader of both the country and the government--not just his own party, etc.

    So, those are the ideals you adhere to? Let's see.

    Of course that's rarely met, but it's an ideal. There are a lot of ideals, and some people view them differently. Reagan and I think Bush (for instance) always wore formal clothes (suit jacket) in the oval office, afaik.

    So how does that meet your ideals? Are you trolling by any chance?

    I'm not saying I care one iota about that, but people have very different ideas of what's expected of the president.

    You don't care one iota yet, it's not one of your ideals, but are going to mention it. Are you trolling again?

    I HAVE heard from even a lot of my liberal friends that at times they have been uncomfortable with some of President Obama's media appearances. ~shrug~

    Since we've established that you don't care one iota about that, who would care except a troll?

    Since you haven't shown that Obama doesn't adhere to your ideals, what point were you trying to make?

    Now, if you weren't trolling - I honestly doubt it but one never knows for sure - then please take the time to read your post again from my perspective and, I'll assume, the perspective of the moderator as well then tell me again why you think your post shouldn't have been modded as such.

  12. Re:Troll?! on President Obama To Appear On Mythbusters · · Score: 1

    In case the bewilderment I believe to be perceiving is, in fact, actually honest - which I'm not saying it's not and to be honest I couldn't care less about - and assuming you are actually not able to see why the post may be considered a troll although I believe that most people could understand why it would be so, I will try to shed some light on this subject.

    I'm not a subject matter expert in trolling but I have friends who tell me they are pretty good at distinguishing between genuine interest and trollish comments so what I say may not be 100% factual although I believe it to be correct.

    First, I don't want to criticize your style of writing, although most people who don't want to criticize something will simply avoid the thing they don't want to criticize altogether unless they have to talk about it to demonstrate some other point. I have just noticed that you have a peculiar way of not criticizing things and as I mentioned already I, myself, think that this is just fine that some people would write like this.

    Second, I HAVE seen it claimed that people who post opinions but try to hide this in the form of maybes and innuendos are often trolling.

    Third, seriously, if some liberal are actually uncomfortable with some of Obama's media appearance, I'll just point out that them that they can take solace in the fact that he can pronounce the word "nuclear".

  13. Re:Can't we just ask? on The Binary Code In Canada's Gov-Gen Coat of Arms · · Score: 1

    When did Fox start using 1's ?

  14. Re:I still can't believe on The Binary Code In Canada's Gov-Gen Coat of Arms · · Score: 2, Insightful

    Did you forget that Michaelle Jean was the previous governor general? I don't think that the bar is that high.

  15. Re:google says.... on Xmarks May Not Be Dead After All · · Score: 1

    Not me. I drink alone. With nobody else. 'Cause you know, when I drink alone, I prefer to be by myself.

  16. Re:How can they tell its tidally locked? on Earth-Like Planet That Could Sustain Life Found · · Score: 1

    It's most commonly referred to as FM.

    So if they always pick up the same radio station, they know that there's no spin? Clever!

  17. Re:Annddd.... on Earth-Like Planet That Could Sustain Life Found · · Score: 1

    He contradicts himself: chances are 100%, almost sure. "Almost" is not 100%.

    Plus what's up with Planet G? Planet M would have been better ;)

    Maybe he meant that he was almost certain that the chances were 100%. Basically there are 2 possibilities. Either there's life or there's no life. If there's life on the planet then the chances are 100% that there's life. If there's no life then the chances are 0%. He's almost certain that option 1 is correct.

  18. Re:Legislation on Motorcyclist Wins Taping Case Against State Police · · Score: 1

    Write it up, get it sponsored or submit it as an initiative so your fellow voters can decide whether or not they agree enough to back your POV.

    You are suggesting that people that are not fluent with the legal system start writing legislation? And then have people that know even less about it should vote on it? I don't believe that's a good idea. Just think of the trouble with the people that voted to restrict the rights of homosexuals in California just to have the judges declare this unconstitutional after spending lots of money and denying the freedoms of homosexuals all the while.

    -- The price of liberty is active participation, not whining...

    There are many ways to participate. Voting, writing to your representative, and whining on public forums are all valid forms.

  19. Re:This is a GOOD THING! on In Canada, Criminal Libel Charges Laid For Criticizing Police · · Score: 1

    IANAL but I know that Guy Lafleur - #10 retired player of the Montreal Canadians hockey team - is counter-suing in a case where he was accused of perjury. The case is a bit complicated and he's suing for the method that was used, but I guess it demonstrates that you can counter sue. As far as I know, M. Lafleur initiated his lawsuit after he was found not guilty. I'm not sure if one could sue for court charges directly.

  20. Re:But what created the law of gravity? on Hawking Picks Physics Over God For Big Bang · · Score: 1

    There's simply not enough time to believe in the Christian god, the IPU, Zeus, and all the other gods out there.
    Assuming there was a god, if you don't believe in the right god, and the 'right' god is a vengeful god, you'll have wasted your life and you'll go to hell anyways.
    But there's worst. What if there is a god and that god goes through the trouble of making sure you can't find any trace of it. Maybe this is just a test to search for people that are just too credulous and send *them* to hell.

  21. Re:grow some skin on Pakistani Lawyer Wants Mark Zuckerberg Executed · · Score: 1

    I though that Muslims believed that Jesus was also a prophet. Why is it OK to make fun of one prophet but not the other?

    Somebody should start a "draw your favorite prophet day". I'd do it but I can't draw and I don't have a favorite prophet.

  22. Re:In Canada on Pakistani Lawyer Wants Mark Zuckerberg Executed · · Score: 1
  23. Re:The French saw it comming on Free Software Wins Court Battle in Quebec · · Score: 1

    Actually, it was quite insulting for the President of France to come to Canada and state that Quebec should be free (independent). We haven't quite forgiven him for interfering in our internal politics while in the position of honoured guest.

    Who's "we"? The rest of Canada? Quebec Federalists? I'll remind you that during the last referendum on separation the vote was very close to 50/50.

    After all, it was France that abandoned Quebec to British rule,

    Then that should have insulted the separatists rather than the federalists. Somehow, I doubt that many separatists were insulted.

    after Wolfe handed Montcalm his ass.

    You do know that Wolfe was killed during that battle?

  24. Re:Need a statistician here... on Australian Schools To Teach Intelligent Design · · Score: 1

    Actually the odds would be 1 in (52*51*50*49*48*...*5*4*3*2*1).

    Sorry, I meant to write 1/(52 factorial).

    After I hit the submit button, I realized that the "1/" was missing and that the "!" might be interpreted as an exclamation mark rather than the factorial symbol.

  25. Re:Need a statistician here... on Australian Schools To Teach Intelligent Design · · Score: 1

    Before life evolved what chance would you give life evolving through darwanian means in this "universe"

    I don't think that the Theory of Evolution says anything about evolution before there is life.

    I think a better question would be:

    What are the odds that life appears where there is none given an infinite amount of time.

    I don't know the answer to that question either but it makes the question more manageable. If the odds are any finite value then the chances are 100%. If the chances are infinitely small then we have 0 x infinity which is undefined without further knowledge.