|
Yes it should.
|
# ¿ Apr 2, 2008 16:54 |
|
|
# ¿ Apr 29, 2024 04:26 |
|
There is at least one C-inspired language that requires that return is used like a function with parentheses and all, as far as I can tell it is mostly because the compiler guy could not be bothered to specialcase return's syntax.
|
# ¿ Apr 3, 2008 20:55 |
|
Flobbster posted:string is a template basic_string is a template, string is a regular type
|
# ¿ May 7, 2008 17:07 |
|
It is implementation-defined
|
# ¿ May 7, 2008 20:44 |
|
Why did you instantiate the enum then?
|
# ¿ May 29, 2008 21:49 |
|
But assignment is way more common than testing equality, so it deserves the shorter operator!
|
# ¿ Jul 5, 2008 12:47 |
|
I do not want to mock the dude because he obviously did not know better and his compiler did not give sufficient warnings, but trying to free a bunch of dynamically allocated objects with delete foo, bar, baz; is pretty depressing.
|
# ¿ Jul 10, 2008 15:19 |
|
As posted in ##c++ on freenode:code:
|
# ¿ Jul 31, 2008 18:33 |
|
chocojosh posted:Would it have been so hard to keep a second vector of invalid nodes and then invalidate those after the for loop? Keeping a vector of invalid nodes does not solve the problem at all because that just replaces the Dirty() check with a check against the vector of invalid nodes. The proper solution (edit: which is not directly compatible with the guy's architecture, yeah) looks like code:
Vanadium fucked around with this message at 20:04 on Jul 31, 2008 |
# ¿ Jul 31, 2008 20:01 |
|
Mustach posted:You're both missing the real problem. DestroyEvent() takes a CGameEvent* (or CGameEvent*&); it's not invalidating any iterators. So, that comment is ironic, because the remaining events won't be iterated. mEvents.begin() isn't going to change, so re-accessing or deleting that element that got destroyed on the first iteration will probably crash the program. I assumed that DestroyEvent was going to modify the vector on its own, looking up the element being destroyed by value.
|
# ¿ Jul 31, 2008 21:39 |
|
Sounds like it should be easily possible to make foo == any_of(bar, baz, qux) work in C++, if some boost lib does not already.
|
# ¿ Aug 27, 2008 21:12 |
|
Flobbster posted:This is also CRAZY and going way out of one's way to implement what amounts to syntactic sugar for a sequence of OR comparisons So basically you are saying it is going to be in the next boost release? Edit: Based on your example, seems to work with gcc 4.3.1: code:
Vanadium fucked around with this message at 22:33 on Aug 27, 2008 |
# ¿ Aug 27, 2008 22:21 |
|
I got pretty much as far, except I did the recursion by composition and not inheritance, but then I tried to wrap boost::call_traits<T>::param_type around everything to avoid needless copying and it all fell apart. Edit: I guess they just gently caress with argument deduction. How does this perfect forwarding thing work again... Any ideas how to make it require less copying? code:
Vanadium fucked around with this message at 00:44 on Aug 28, 2008 |
# ¿ Aug 28, 2008 00:29 |
|
RegonaldPointdexter posted:I saw this in some JavaScript yesterday: Looks like the loop would potentially reset change to true if it turned out it did not actually want to exit, and the first "change = false" is just a quick hack to disable the loop entirely.
|
# ¿ Aug 28, 2008 22:10 |
|
Anonymous Name posted:It's exactly like a pointer in implementation, of course. Pointers behave nowhere near exactly like this: code:
|
# ¿ Sep 1, 2008 05:06 |
|
I am not really willing to give up the convinience of using references for "out" parameters just so you guys do not have to look up the function, sorry guys
|
# ¿ Sep 2, 2008 00:39 |
|
floWenoL posted:If you were using Perl you'd be able to type 5_000_000. We can probably come up with something that lets you type num<5,000,0wait this is not going to work
|
# ¿ Sep 4, 2008 19:58 |
|
Standish posted:gently caress octal seriously, has anyone ever encountered it where it wasn't causing a weird bug with leading zeroes? chmod(1)
|
# ¿ Sep 4, 2008 20:31 |
|
meba rhodium posted:I've been trying to wrap my head around this one line of code for hours and I still have no idea. What does it look like if you just view the preprocessed code?
|
# ¿ Sep 11, 2008 18:02 |
|
So would you prefix a smart pointer object variable with p?
|
# ¿ Oct 2, 2008 22:11 |
|
JoeNotCharles posted:How do you get int confused with FILE * and not notice? Well, if he is calling it like FILE* f = open("foo", O_RDONLY); and not getting a warning for that conversion either, the whole thing might just work!
|
# ¿ Oct 7, 2008 02:25 |
|
Ruby does not catch the ^C exception from a "begin; rescue; end", you actually need to go up the Exception inheritance thing to explicitly catch everything.
|
# ¿ Nov 5, 2008 18:24 |
|
A logic error that deserves to be punished with undefined behaviour~
|
# ¿ Nov 8, 2008 18:20 |
|
ashgromnies posted:who the gently caress in the history of computing thought, "ah, yes, xml is a decent markup language for organizing data... let's make code out of it" It worked for lisp
|
# ¿ Nov 26, 2008 22:56 |
|
Guys, I am sure the .toString() calls get inlined...
|
# ¿ Dec 8, 2008 19:34 |
|
That just makes the code more portable. In Ruby it is common practice to call .to_s on string-like objects
|
# ¿ Dec 8, 2008 19:51 |
|
Mustach posted:You can't subclass java.lang.String. welp, you can in C++ using gcj's java interface.
|
# ¿ Dec 8, 2008 20:13 |
|
Please tell me that was actually a system and not an exec. Edit: Ignore me, I got my sigil'ing languages mixed up.
|
# ¿ Dec 9, 2008 16:58 |
|
Triple Tech posted:At first I was with you. But I can count at least three strikes against Perl. The function, the param, and the echo. And no my, how dare they. I figured exec did the same thing everywhere and did not actually look that closely Yeah, perhaps I just assumed the perl guys had come up with a reasonable function definition syntax since I last played with it, but I guess that would be stupid
|
# ¿ Dec 9, 2008 17:21 |
|
mr_jim posted:It took me a while to notice the problem with that code. I kept thinking "Well, it looks reasonable... I kept trying to figure out how it would arrive at a wrong answer and could not come up with anything.
|
# ¿ Jan 1, 2009 21:04 |
|
I ended up realising that I was looking for the wrong thing, yeah.
|
# ¿ Jan 1, 2009 21:42 |
|
That might be faster, but it is not a really generic solution to the problem.code:
|
# ¿ Jan 6, 2009 00:39 |
|
Smackbilly posted:Can't wait for C++0x lambda functions to make STL predicates so much less a pain in the rear end. Oh, but there is already boost.phoenix to tempt you with the prospect of making STL predicates so very elegant and easy, only to drown you in an ocean of template errors if you actually try to use it
|
# ¿ Jan 18, 2009 02:50 |
|
ymgve posted:But nobody did that. The only person that did was in the example above you. The Python code is 100% valid and safe, because the formatting part is a literal. That was just an explanation how to possibly get it wrong in C, because defending against that is what the dude did in Python. The joke is not that the python guy did something unsafe, it is that he used formatting operations to protect against a danger that does not even come with Python's print function.
|
# ¿ May 9, 2009 13:07 |
|
It just is undefined, since both the assignment itself and the ++ modify i, which is illegal because there is no sequence point inbetween.
|
# ¿ May 10, 2009 20:25 |
|
no this is not "who knows what the value of i is going to be afterwards", this is literally undefined behaviour you do not have to argue why it is because it just says in the standard not to do that poo poo
|
# ¿ May 10, 2009 20:32 |
|
Triple Tech posted:Some "developers" don't know of platform agnostic interfaces to system commands... Are you suggesting that some dude is trying to avoid hardcoding a WinAPI call in order to stay portable? It is not like del is. Edit: It appears you are, in fact, not. Carry on. Vanadium fucked around with this message at 19:14 on May 13, 2009 |
# ¿ May 13, 2009 19:04 |
|
It's C++. I do not know any, either.
|
# ¿ May 13, 2009 22:37 |
|
I could have sworn that was only POSIX. Hooray for standards.
|
# ¿ May 13, 2009 23:08 |
|
|
# ¿ Apr 29, 2024 04:26 |
|
Mustach posted:I don't buy type erasure as the excuse for not being able to say new T[n]. That expression doesn't even need any type information since the elements are all initialized to null and no other "T" methods are used. It needs to plug the type T into the array type at some point so RTTI can proceed to ask for the array's type. Which does not work if T gets erased.
|
# ¿ May 16, 2009 03:51 |