Lets ensure this global variable gets deleted



  • @jmp said:

    It's not just that 'intellisense errors' are consistently wrong and/or out of date by five minutes, it's just aesthetically unpleasing.

    Since I switched to YouCompleteMe, they are correct and if they are a bit behind, refreshing them is easy. And I don't mind them aesthetically, but if I did, they can be reconfigured easily.



  • The formatting of this post is so discofied that I have no idea if you were talking to me or not. I got a quote notification from it...



  • @asdf said:

    You should get a better computer then. I rarely have that problem.

    In C++? When I used C# it was pretty good, but something something GLR language most vexing parse.

    Using VS2015 on a pretty reasonable computer (recent i7) I can usually outpace intellisense and semi-regularly run into things where I'm writing a class or something and intellisense has correctly indicated that some variable doesn't exist in the global scope without figuring out it's a variable I just declared 30 seconds ago. I don't usually keep source on an SSD and my devbox at work the SSD is too small for both Windows and the checked-out repository (which is gigantic for terrible reasons). This is all in fairly small projects with 3 large external libraries at best. One of them is boost, though, which might matter.

    @asdf said:

    What kind of visual indicator would you prefer for errors?

    The table in a separate window is fine.

    It's not a huge annoyance, I can turn them off. More a minor irritant I guess. If I couldn't turn them off I'd be seriously considering Notepad++ as an alternative IDE.

    @Bulb said:

    Since I switched to YouCompleteMe, they are correct and if they are a bit behind, refreshing them is easy. And I don't mind them aesthetically, but if I did, they can be reconfigured easily.

    Thanks, will look into that.

    EDIT: Ick, Vim. 😛. I was referring to Intellisense specifically, I haven't run into many other semantic autocompletes.


  • Winner of the 2016 Presidential Election

    @jmp said:

    I was referring to Intellisense specifically, I haven't run into many other semantic autocompletes.

    ReSharper C++?

    @jmp said:

    I can usually outpace intellisense and semi-regularly run into things where I'm writing a class or something and intellisense has correctly indicated that some variable doesn't exist in the global scope without figuring out it's a variable I just declared 30 seconds ago

    Hm, then your project is either way larger than the ones I've used VS for or ReSharper makes a big difference.



  • As I've said before, the C spec people should rename the language if 2011 C++ is so much better/different than every other C++ since 1995.



  • @jmp said:

    EDIT: Ick, Vim.

    It is supported in some other editors too now. Not Visual Stupido though.



  • @jmp said:

    It's not just that 'intellisense errors' are consistently wrong and/or out of date by five minutes, it's just aesthetically unpleasing.

    The goal is to write quality software. If you just want to look at pretty pictures, try Pinterest.



  • @Bulb said:

    Not Visual Stupido though.

    Oh SNAP boy-eeeeee.



  • Never used ReSharper.

    @asdf said:

    Hm, then your project is either way larger than the ones I've used VS for or ReSharper makes a big difference.

    The repo contains millions of lines of code because everything is terrible and nothing works, but any given project shouldn't touch that many. Maybe it's boost.

    @blakeyrat said:

    As I've said before, the C spec people should rename the language if 2011 C++ is so much better/different than every other C++ since 1995.

    Why? It's backwards compatible with 99.9% of the old stuff, it's going to be used for pretty much the same stuff by a pretty similar group of people, you're going to use similar tools for it. Is this just a rebranding thing? C++ doesn't need marketing.

    @blakeyrat said:

    The goal is to write quality software. If you just want to look at pretty pictures, try Pinterest.

    Don't you get tetchy about font rendering errors? I remember that being a thing. I also find them distracting, so there you go, in addition to them being incorrect and therefore useless they draw the eye to look at the thing that's incorrect and therefore useless.



  • @asdf said:

    ReSharper C++?

    RePlusPlusser?



  • @jmp said:

    Why? It's backwards compatible with 99.9% of the old stuff, it's going to be used for pretty much the same stuff by a pretty similar group of people, you're going to use similar tools for it. Is this just a rebranding thing? C++ doesn't need marketing.

    Ok but then you're not allowed to complain that when people do Google searches for C++ code samples, they're getting samples that all do it the old "wrong" way.

    And "naming something" isn't marketing. It's just naming. I'm not saying they should do a TV and billboard blitz, I'm just saying that if it's a significant break from older C++ code style, it should have a new name so Google won't mix them up.

    @jmp said:

    Don't you get tetchy about font rendering errors?

    I don't even know what the word "tetchy" means.

    But yes, I notice font rendering errors. You know why? Because the goal is to create quality software, and if you somehow fucked-up FONT RENDERING, you ain't met that goal.



  • @blakeyrat said:

    Ok but then you're not allowed to complain that when people do Google searches for C++ code samples, they're getting samples that all do it the old "wrong" way.

    And "naming something" isn't marketing. It's just naming. I'm not saying they should do a TV and billboard blitz, I'm just saying that if it's a significant break from older C++ code style, it should have a new name so Google won't mix them up.

    That's a good point. StackOverflow and the like have a separate C++11 tag, and most of the activity in the C++ tag directs people in C++11 directions while answering extremely basic questions and ignoring anything hard, with a side-order of standards-lawyering. Most of the rest of the online tutorial space is a horrid wasteland. I don't really go around looking for code samples, so I couldn't tell you whether that's any different to other languages. I'd imagine Java and C# have similar problems with people dragging up old deprecated APIs and/or long-form ways of doing things. Java's gone through what, four standard/semi-standard GUI toolkits?

    @blakeyrat said:

    I don't even know what the word "tetchy" means.

    Annoyed.

    @blakeyrat said:

    But yes, I notice font rendering errors. You know why? Because the goal is to create quality software, and if you somehow fucked-up FONT RENDERING, you ain't met that goal.

    Okay. So if your software is putting eye-drawing ugly visual indicators on the screen to indicate errors where there are no errors, would you consider it to be quality software?



  • @jmp said:

    Java's gone through what, four standard/semi-standard GUI toolkits?

    More or less.

    3 Standard: AWT, Swing, JavaFX
    1 Semi-Standard: SWT

    Having said that, none of these are deprecated.



  • @Steve_The_Cynic said:

    The f(riendly) compiler decided to generate code that was the equivalent of:

     unsigned char temp = bp++;
      *temp = /* same RHS as before */;

    that is, increment the pointer before evaluating the RHS, but use the before-increment value as the address of the target of the assignment, instead of the version that all the other compilers produced, essentially this:

      *bp = /* same RHS as before */;
      bp++;

    that is, do all the calculations and the assignment, then increment the pointer.

    I spent about 5 minutes squinting at this and thinking that those looked pretty much exactly equivalent, before I remembered that /* same RHS as before */ had used the current value of bp, so it matters whether you increment bp before or after calculating. Replacing RHS with a comment that didn't mention it using bp made it kind of difficult to see the :wtf:...



  • There's not a lot in C# that's deprecated. There's the old pre-generic collection classes, I guess, like HashTable and ArrayList. They're not really "deprecated" deprecated, as it's possible some C# applications are still running on older frameworks where they're fine.

    @jmp said:

    Okay. So if your software is putting eye-drawing ugly visual indicators on the screen to indicate errors where there are no errors, would you consider it to be quality software?

    Not if they're erroneous. But that wasn't what you were complaining about; you were complaining about them being ugly. (And specifically stated, I might point out, that you were ignoring the fact that they aren't always accurate.)

    For this purpose, I'd almost prefer "ugly" as it gives some incentive to go and fix those.



  • @blakeyrat said:

    There's not a lot in C# that's deprecated. There's the old pre-generic collection classes, I guess, like HashTable and ArrayList. They're not really "deprecated" deprecated, as it's possible some C# applications are still running on older frameworks where they're fine.

    Winforms kind of is. They still support it, but they don't really want people to keep using it from what I can tell.

    Though it's still really solid and works fine, so it's certainly nothing like Java.



  • I don't count WinForms as "in C#".



  • Fair. C# itself isn't that large really. Can't really think of many language level ones, apart from, perhaps, the old wrong behavior of

    foreach(var thing in things)
      Console.WriteLine(thing.Select(t => t.Frop).Aggregate(string.Empty, (a, b) => a + b));
    

    ...but if anyone was relying on that, they're insane in the first place.


  • Discourse touched me in a no-no place

    @jmp said:

    Are you seriously

    No, he's going to keep :moving_goal_post: as long as he can argue with you and say stuff he doesn't like is stupid. It's what he does.



  • @jmp said:

    How did he avoid the nasal demons?

    UB doesn't necessarily result in observable crashes. Which sometimes makes it hard to explain it to people ("but it runs fine!").

    @Steve_The_Cynic said:

    t could easily be defined to move the ownership to the callee's copy of the object, but that would be a serious WTF in its own right, as in "WTF? I called that function and it was OK, but then I called the other one and my pointer got NULLed. WTF?"

    auto_ptr worked that way. It's a terrible idea and one of primary reasons for introducing move semantics.

    @Kian said:

    You'd normally just declare the copy-constructor private, so that when you try to copy the compiler tells you "you tried to call the copy constructor, but it's private".

    = delete!



  • @Magus said:

    ...but if anyone was relying on that, they're insane in the first place.

    👋



  • @anotherusername said:

    I spent about 5 minutes squinting at this and thinking that those looked pretty much exactly equivalent, before I remembered that /* same RHS as before */ had used the current value of bp, so it matters whether you increment bp before or after calculating. Replacing RHS with a comment that didn't mention it using bp made it kind of difficult to see the :wtf:...

    Overall, I'd say that makes you AWTF, because you read "same RHS as before" to mean "an RHS sort of similar to the one that was there before, but different." :wtf: And also because I wrote out the necessary words to explain the difference.

    And it makes me AWTF as well, because I was too lazy to copy/paste the previous RHS. But not too lazy to type the comment and then copy/paste it. :wtf: :wtf: And also because I wrote out the necessary words to explain the difference, but didn't take the two seconds needed to copy/paste the original RHS.

    I'm not sure which of us is more :wtf: in this, except that neither of us is as :wtf: as the code.



  • @CatPlusPlus said:

    @Steve_The_Cynic said:
    t could easily be defined to move the ownership to the callee's copy of the object, but that would be a serious WTF in its own right, as in "WTF? I called that function and it was OK, but then I called the other one and my pointer got NULLed. WTF?"

    auto_ptr worked that way. It's a terrible idea and one of primary reasons for introducing move semantics.


    OK, so the key feature of the new one is that the move is explicit.



  • @LB_ said:

    The formatting of this post is so discofied that I have no idea if you were talking to me or not. I got a quote notification from it...

    More to the point, the formatting is broken, even by the standards of Dicksucks.

    @discodevs Please nuke the pink "Consider replying to several posts at once" box from orbit. I want it to fuck off and die, forever. Where's the "OK, I heard you, now fuck off and leave me alone" checkbox?



  • @Steve_The_Cynic said:

    you read "same RHS as before" to mean "an RHS sort of similar to the one that was there before, but different."

    ...what? No. I just failed to remember what it was, and the fact that it was replaced with a comment made me think it wasn't important to the WTF when it was.

    @Steve_The_Cynic said:

    I was too lazy to copy/paste the previous RHS. But not too lazy to type the comment

    To be honest, just adding the information to the comment like /* RHS that depends on bp */ would've highlighted the key information instead of hiding it.

    @Steve_The_Cynic said:

    neither of us is as :wtf: as the code.

    That's for certain.

    @Steve_The_Cynic said:

    Please nuke the pink "Consider replying to several posts at once" box from orbit.

    I guess you could probably write a CSS rule that kills it. Probably along with all the other :disco: toasters... I don't know if you could identify that one specifically.



  • @Steve_The_Cynic said:

    OK, so the key feature of the new one is that the move is explicit.

    Not exactly. More that moving is now something that exists. In a lot of contexts, the move is implicit. In technical terms, you can declare a method's parameters by value, by reference, and now by "r-value reference". Roughly, r-value reference translates to temporary. A constructor that takes an object of it's own type by r-value ref is called a move constructor, and it may modify the object passed to it (to copy any pointers it has, for example, and then set them to null).

    "Move-only" types are types that have disabled the copy constructor, but still have a move constructor (same for assignment operators, you can have copy-assign and move-assign and they follow the same rules). Since an lvalue (anything that has a name and whose address you can take, roughly) can't bind to an r-value ref, if you declare a move-only type as a value parameter in a method, you'll only be able to create the parameter from r-value refs.

    What you can do, is cast an lvalue ref to an r-value ref. Which is what std::move does. So if you call std::move on something, and pass it to someone expecting an r-value ref, you can now move the contents of the existing value.

    In layman's terms, temporaries will be moved instead of copied, and you can call an explicit move on things that are already declared:

    #include <memory>
    
    std::unique_ptr<int> FuncThatReturnsOwningPointer();
    void FuncThatConsumesOwningPointer(std::unique_ptr<int> ptr);
    
    void f() {
      auto myPtr = FuncThatReturnsOwningPointer();  // Move is most likely elided here, as the called function
      // is allowed to create the return value in the local storage of the calling function.
      // Some conditions apply.
      myPtr = FuncThatReturnsOwningPointer();  // Calling it again on an existing pointer will move the result
      // of the function into the existing pointer. No special syntax is required because the return value is a
      // temporary that stops existing at the semi-colon. The previous object held by myPtr is destroyed since
      // there's no one holding on to it.
      FuncThatConsumesOwningPointer(FuncThatReturnsOwningPointer());  // You can also construct the thing
      // directly on a parameter without special syntax.
      
      /* FuncThatConsumesOwningPointer(myPtr); */ // Compiler error. The function wants to copy the value, but
      // unique_ptr can't be copied.
      FuncThatConsumesOwningPointer(std::move(myPtr));  // Using std::move, I can explicitly call the move
      // constructor with a value I already owned. The function now owns the pointed object, and when myPtr goes
      // out of scope at the closing brace below, it will not free the object.
    }
    


  • wait, so you have code that relies on the .net 3.5 behavior of the linq expression using the first item in every iteration?



  • ... :wtf:

    I was going to type in what that code meant and say that there was nothing wrong with it and asked you what was wrong, but then I realized...

    things is an IQueryable of thing, each of which is an IQueryable of t, each of which has a Frop you can cast to string.

    WTF are you smoking with that object graph?



  • Hey, people make jagged collections all the time!

    But basically old .NET would print that as "aaaaaaa" instead of "abcdefg". And I seriously doubt you have any code that relies on that.



  • Can you give me an example where that would not be a bug? Cause that seems unlikely. (instead of just doing it "right" that is)



  • No, you give me one! That's what I've been asking this whole time. The old C# compiler was buggy and made closures in foreaches only ever use the first value unless you introduced a local in the foreach and assigned the current iteration to it. It was definitely buggy and wrong, and it's very unlikely that anyone needed that behavior. About all I can imagine using it for is comparing everything against the first value, but that's still a horribly wrong thing to rely on!


Log in to reply