Slashdot Mirror


User: darkwing_bmf

darkwing_bmf's activity in the archive.

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

Comments · 739

  1. Re:Streaming (to file) on The Most Expensive One-Byte Mistake · · Score: 1

    You don't write out the length of the string to the file just because you're using a different programming language. When implementing a design, your goal should be to make the output the same regardless of language. And if you think fixed length string languages need to "read in" a separate length then you need to learn some programming languages that don't have C in their name.

  2. Re:Streaming (to file) on The Most Expensive One-Byte Mistake · · Score: 1

    Are you making this up as you go? There's nothing about knowing the length of the string that makes writing to files harder. In fact it makes it easier because you can write out chunks at a time instead of one byte at a time.

  3. Re:TFA: a rebuttal on The Most Expensive One-Byte Mistake · · Score: 1

    The compiler argument is uninformed about how compilers work, and are permitted to work by the C standard.

    When discussing the rationalizations for whether or not something should have been in the C standard, referencing the C standard for justification is circular logic.

  4. Re:The decision was different! on The Most Expensive One-Byte Mistake · · Score: 1

    if (test_1) {
          foo; /* test_1 is now garbage */
          bar_flag = 1;
    }
    if (bar_flag || test_2) {
          bar;
    }

    Would a simple "do this thing" flag not work? It does take an extra assignment and comparison but that might be faster than reading an address from memory and jumping to that address.

  5. Re:Pascal string hell on The Most Expensive One-Byte Mistake · · Score: 1

    Not all fixed string languages are Pascal.

  6. Re:Sorry, he's wrong on The Most Expensive One-Byte Mistake · · Score: 1

    That's only if the string is passed to a separately compiled function. You're talking about implementation details. But even assuming an extra pointer is needed, those really don't take up a lot of space in comparison to the character data itself. Certainly today the benefits gained by knowing the length of the string far outweigh any drawbacks in memory usage. And even back when memory was scarce... well, if one byte is that much concern then even C is too much. Do it in assembly and pre-calculate your character array storage needs.

  7. Re:They could have offered both. on The Most Expensive One-Byte Mistake · · Score: 1

    The could have offered both solutions. But I'd argue the "known length" string operations would be faster than the "search for null" ones.

  8. Re:Missed the point on The Most Expensive One-Byte Mistake · · Score: 2

    Really? How is Ada less powerful than C?

  9. Re:The decision was different! on The Most Expensive One-Byte Mistake · · Score: 1

    if (test_1) {
          foo;
    }
    if (test_1 || test_2) {
          bar;
    }

    Something like that?

  10. Re:Sorry, he's wrong on The Most Expensive One-Byte Mistake · · Score: 1

    Constant strings are another matter, they don't have the malloc header so something else would have to be done. Probably the easiest would be to set the malloc length to zero, it's a constant after all so doesn't need to be freed or overwritten. That does mean 4.5 bytes overhead (including alignment) though.

    For constant strings the compiler could keep track of the size. You could use even less memory than C.

  11. Re:It's easier to blame someone else on The Most Expensive One-Byte Mistake · · Score: 1

    The problem with C strings is the same problem everyone has with C and assembler. It requires you to be absolutely competent. ...
    The vulnerabilities to specially crafted attacks aren't mistakes. They were design choices that were correct given the knowledge the designers had at the time. Times have changed and nobody wants to pay to redo the code

    According to what you wrote, the problem with C strings is not that the original programmer has to be absolutely competent, it's that that burden is placed on all future generations who use the code as well.

  12. Re:Streaming (to file) on The Most Expensive One-Byte Mistake · · Score: 1

    With sized strings you need to know the length of the complete string before you begin streaming. So you'd stream the size first, followed by the content of the string. Not good if your string could be very long and memory is expensive.

    With sized stings you do know the length of the complete string. That's the whole point. And it's even better with expensive memory because you only need to allocate the given size and not some "I'm not sure how big this is going to be, I hope it doesn't try to write past the end of the buffer" size.

  13. Re:The decision was different! on The Most Expensive One-Byte Mistake · · Score: 1

    Text files ... should every line now start with 2 bytes length indicator?

    Text files are not the same as "strings". "String length" languages can handle standard ascii text files just as well or better than C.

  14. Re:Missed the point on The Most Expensive One-Byte Mistake · · Score: 1

    my_string : strings := "Content-Length: 12345";
    content_length : integer := my_function (my_string (17 .. my_string'length));

  15. Re:Hoping on Internet-Based Political Party Opens Doors · · Score: 1

    our country was founded on legal immigration.

    Our country was founded on the backs of colonial empires who wanted the resources of the new world and weren't afraid to take them from the natives.

  16. Re:I've been waiting for this. on Massachusetts Plans To Keep Track of Where Your Car Has Been · · Score: 1

    May be, but IMOHO, because of how poor the education system has become in the US (largely thanks to the no child left behind movement), the majority of people don't understand the extreme importance of every amendment contained within the Bill Of Rights.

    Most adult Americans were out of school when no child left behind became law. I understand your point but you don't have to be overly political about it.

  17. Re:Umm...yeah no shit. I could have told you this. on Can a Playground Be Too Safe? · · Score: 1

    There exists a lower bound to intelligence.

    Some days I have my doubts about that assertion.

  18. Re:Netflix wasn't more than that? on Why Netflix Had To Raise Its Prices · · Score: 1

    You might be having a latency issue. It works just fine in the US when I stream, PC or Wii.

  19. Re:Whiners... on Why Netflix Had To Raise Its Prices · · Score: 4, Insightful

    If what is currently "dvd only" content was made available for streaming at the same time the price was hiked, then I believe most people would have been okay with it.

  20. Re:Good idea. on Court Allows Webcam Spying On Rental Laptops · · Score: 1

    A photo of the criminal's face will help with prosecution.

  21. Good idea. on Court Allows Webcam Spying On Rental Laptops · · Score: 1

    It's basically an anti-theft system. If someone steals Aaron's laptop they'll have a better chance of tracking that person down. I wish my own computer had that feature.

  22. Re:Ugh on Amazon Plans iPad Competitor (and 2 New Kindles) · · Score: 1

    Ditch the sig. Listing certs looks unprofessional. Let your posts stand or fall on their content.

  23. Re:What's the programming language? on Stanford Students Build "JediBot" · · Score: 1

    KUKA robot language.

  24. Re:Basic on Stanford Students Build "JediBot" · · Score: 1

    At first I thought it looked like BASIC too but after some Google-Fu I'm pretty sure it's KUKA Robot Language.

  25. Re:Well on Green Card Lottery Judgment Favors Mathematical Randomness · · Score: 1

    But in your example, the jury is attempting to rule on the basis of scientific fact. An "expert" in court is deemed to be as credible as the "expert" that wrote the textbook.