« first day (212 days earlier)      last day (4721 days later) » 
02:00 - 14:0014:00 - 23:00

2:05 AM
hi
 
2:38 AM
hi all...:)
 
2:57 AM
0
Q: boost::program_options::positional_options_description termination

wilhelmtellThe following program aborts with pointer being freed was not allocated: #include <boost/program_options.hpp> int main(int argc, char* argv[]) { boost::program_options::positional_options_description positional; return 0; } I compiled and linked the program with Boost 1.46.1, wh...

 
you know, the text from your previous post is still on my screen.
 
So is yours.
:p
 
yeah, but I didn't post the same thing twice
 
You mean you never said "hi" before?
You're so kind. I'd delete that link post if I could.
 
my post has a time context to it, yours does not
 
Xeo
3:35 AM
guys
Are you little kids? :/
 
the chat is not for spamming links to questions
 
Xeo
Did he spam? I only see the link here once
 
scroll up five feet and you'll see that he originally asked here
 
Xeo
Well, I consider asking here and actually posting a link to a question 2 different things. If someone now magically knows the answer, he can post it through the question link.
Oh btw
6
Q: 'warning C4709: comma operator within array index expression' - but no comma to be seen anywhere!

XeoTake this little example code: #include <map> using namespace std; struct wrapper{ int _value; bool operator==(wrapper const& rhs) const{ return _value == rhs._value; } bool operator<(wrapper const& rhs) const{ return _value < rhs._value; ...

 
if someone here knows the answer, he would have said it the first time
 
Xeo
3:42 AM
anyone can submit that as an error report to msdn connect? I'd need to register..
 
damn, I hate Javascript
 
 
2 hours later…
5:22 AM
What does address of a reference mean ? Why cannot we take the address of a reference ?
 
is this sentence right "i am proud of you" ?
 
Xeo
5:39 AM
@balasbellobas Well, you can, but you wont get the address of the reference object, say, int&
that is because a reference is just an alias for another object.
int i = 4;
int& ri = i;
int* pi = &ri; // gets address of 'i'
 
Okay . So it is not a compile error to get a address of a reference
 
Xeo
nope
0
Q: Is it possible to "prepare" input from cin?

XeoIn his answer, specifically in the linked Ideone example, @Nawaz shows how you can change the buffer object of cout to write to something else. This made me think of utilizing that to prepare input from cin, by filling its streambuf: #include <iostream> #include <sstream> using names...

One last close vote in here please: stackoverflow.com/questions/6013585/…
 
6:06 AM
hi all
i have some problems that i made in codeblock
but now i want to uninstall the codeblock
so that programs will not work in VS 2010 ?
is it?
 
 
1 hour later…
7:19 AM
@Miss the only thing wrong with that sentence is you should use "I" not "i".
 
@reno ah ok ok ok thanks
@reno: i have solved second problem. . ok
 
@Miss are you the same person as tina?
 
Xeo
@Reno cough No, totally not cough .. Ew, I need to get some cough syrup...
 
7:37 AM
 
cpx
I think no one has been able to get an answer of that question from her yet lol.
 
Xeo
@cpx him
 
I know ... girls trying to be mysterious puts me in troll mode.
Random: I've just started using Stanza an iPhone app for reading an ebook. Its ****-amazing
and its not supported in android
 
8:22 AM
Goood morning :)
bah c++0x on gcc 4.5 blah.cpp:11:106: error: ‘nullptr’ was not declared in this scope
 
@nils: good afternoon but good morning for you..:)
 
Xeo
@Nils gcc still doesn't support nullptr?
 
at least not 4.5
 
I have to leave...good bye lounge<c++> ...:)
 
have a nice day
 
8:42 AM
@Xeo It was introduced in 4.6
 
9:05 AM
Question about boost::array how can I write a function which creates a boost::array and determines the array size when the array is constructed inside the function
boost::array<double, n> createArray(); requires the size of the array
 
@Nils, array isn't a replacement for vector, it is a replacement for C arrays.
 
sure
 
You can only determine the size at compile-time, because it's a template parameter.
 
but using C arrays this would be int createArray(**arrayPtr)
where int may be the size of the array
that's retarded
 
@Nils That would be a dynamic array
 
9:08 AM
Similar to new[].
 
nah you should provide the size when it's allocated
and it should not be part of the type
 
There is no allocation when using boost::array
 
@Nils Then you can't use arrays.
 
If the size is only known at runtime, you want std::vector.
 
so far I wanted double *blah = new double[lengthDetAtRuntime];
 
9:09 AM
@Nils You cannot do that with std::array.
 
humm
 
Why not use std::vector<double> blah(lengthDetAtRuntime);?
 
there is scoped_array
@FredOverflow I need to access the data under it directly
 
Xeo
@Nils What's wrong with &blah[0]?
 
double* p = &my_vector[0];
 
9:11 AM
@Nils std::vector<T>::data
 
Xeo
Direct access to the underlying buffer
@LucDanton Wasn't data C++0x?
 
Why not use scoped array?
 
Why not use vector?
 
@Xeo It appears it is; I must have been using an extension all this time then
 
Xeo
aren't both basically the same, safe for the option to extend the vector ?
 
9:13 AM
Well without move semantics I find the idea of returning a scoped_array suspect
 
are there any examples on how to use scoped_array somewhere?
 
Why not use vector? More programmers will be able to understand your code if you use vector.
 
@FredOverflow I don't want to resize it, just determine the size at runtime.. but would probably be an optioon
 
Xeo
@Nils Why are you so reluctant to use std::vector?
 
I always considered scoped_array an adaptor to use a C API in an exception safe way
 
9:14 AM
@Xeo I'm not, just not sure weather it's the best option
 
@Nils Exactly what makes it not the best?
 
Xeo
@Nils scoped_array only has some functions and 1 pointer less, everything else should be the same
 
Is it even possible to return a scoped_ptr? Does it have a copy constructor?
 
boost::scoped_array is noncopyable.
 
Xeo
Anyways, when do we C++ coder get variable length arrays?
 
9:16 AM
Not sure how std::vector arranges the underlying data
 
sbi
18 hours ago, by Fred Nurk
@sbi how are synonyms unlinked without a moderator?
 
Then you cannot return it. Forget scoped_array, it's not the tool you're looking for.
 
sbi
@FredNurk When their score drops to -2.
 
Xeo
@Nils In a contigiuous memory block
It's even demanded by the standard
mornin' @sbi!
 
:)
ah
 
sbi
9:17 AM
@Xeo Heya! Are you gonna come on Sat?
 
then what's the array class in boost for?
lol
 
@Nils No dynamic allocation.
 
Xeo
@sbi It seems I can't, I need to babysit my little brother on his fathers birthday >_>"
 
The array class is like a C array but without all the annoying special rules.
And with a nice STL interface.
 
Xeo
@FredOverflow Wait, how does scoped_array not do a dynamic allocation?
 
9:18 AM
@Xeo boost::array, not boost::scoped_array
 
Xeo
@LucDanton Yeah, but @Nils is talking about scoped_array the whole time
 
@Nils Are you talking about array or scoped_array here?
 
nah
i just want a wrapper around my memory which makes it easier
 
Again, just use std::vector and move on.
2
 
Xeo
3 mins ago, by Xeo
Anyways, when do we C++ coder get variable length arrays?
Anyone?
 
9:19 AM
ok
thx
:)
 
morning all!
 
@Xeo VLAs do not mix well with C++'s type system. We're probably never gonna get them. Which is fine with me.
3
 
Xeo
It's a tiger! Get into the cage!
 
@Xeo lol :P
 
sbi
@Xeo Ah, c'mon! You could at the very least try harder and get a better excuse.
 
Xeo
9:21 AM
@sbi I wish it was an excuse...
 
sbi
@Xeo VLAs in C++ are spelled std::vector, fully implemented in C++, and put into a library.
In C++, the standard library can be implemented in the language itself, with no external magic. I find that very impressive.
 
Xeo
@sbi lol. Save for the fact, that VLAs are on the stack and vectors are on the heap?
 
sbi
@Xeo You can write a stack-based dynamic array in C++. It's just that there's rarely any use for it.
 
Xeo
@sbi Now, let me see that.
 
Sounds like a job for scoped_array actually
 
Xeo
9:30 AM
@LucDanton How is scoped_array different from a vector in this case?
 
@Xeo alloca
 
sbi
@Xeo To say it politely: Again not coming to a meetup, by the excuse that you need to babysit, is not very helpful to your claim of being male. :)
 
Xeo
Ah, i totally forgot alloca
 
sbi
@Xeo Writing a std::vector-alike is no beginner's task, but not too hard either, and std::alloca() is available from the C std lib.
 
Xeo
@sbi Shaddup. :|
@sbi Yeah, I forgot alloca
 
sbi
9:32 AM
@Xeo That's one of the things I'm not really good at. :)
 
Xeo
@sbi I already noticed that. :P
 
sbi
@Xeo Did I mention that C++' ability to create such things within the language impresses me?
 
alloca is non standard AFAIK
also never mind my bit about boost::scoped_array, there no way to specify a custom deleter
 
Xeo
@sbi Well, C++ is like a very fertile ground. Wonderful things can sprout from it without any further assistance. Sadly, it can also be used to plant those maneaters and stuff. :)
1
Q: VTABLE for abstract classes C++

vBxDoes a vtable gets created for an abstract class that have pure virtual functions and virtual functions ? class Abstarct { public: virtual void f() = 0; virtual void g() {} }; Thanks.

 
9:53 AM
Someone else that thinks SO is his own personal human-powered compiler.
-4
Q: C/C++: Is this undefined behavior? (2D arrays)

PaulIs it undefined behavior if I go through the elements of a 2D array in the following manner? int v[5][5], i; for (i = 0; i < 5*5; ++i) { v[i] = i; } Then again, does it even compile? (I can't try it right now, I'm not at home.) If it doesn't, then imagine I somehow acquired a pointer ...

 
Xeo
Anyways, I'm off for today, see ya
 
@MartinhoFernandes As a matter of fact, I think the underlying problem is interesting.
 
sbi
SO just disappeared for me. "The connection has timed out."
 
@sbi SO works for me
 
sbi
@TonyTheTiger It's back for me, too, now.
 
10:07 AM
@sbi oh ok
 
10:20 AM
@AProgrammer Yes, the question of whether it's UB or not is valid. But "I can't try it here, does it compile?" really annoys me.
 
10:30 AM
Error 60 error LNK2019: unresolved external symbol "int __cdecl maxNum(int *)" (?maxNum@@YAHPAH@Z) referenced in function "void __cdecl DibHomoginityDetect(class CDib &)" (?DibHomoginityDetect@@YAXAAVCDib@@@Z)
 
@Miss The usual. The linker can't find maxNum, and it needs it to link DibHomoginityDetect.
Sigh.
 
yes after posting here , i understood the error
i am using VS 2010
i put the break point and i want to go inside the function
as i know key F11 is used for that ..
but my VS 2010 is not accepting F10 for going inside the function
why ?
yes step into ==> F11
 
Hey, does anyone here know about wininet Http connections?
 
ah now its works.
 
Or has anyone experienced slower performance with IE8 when compared to IE6 when huge number of connections are involved? (IE being used programmatically)
I take that as a no then. Thanks.
 
10:47 AM
How do I allocate a vector on the heap and get a reference to it?
vector<int>& blah = (*new vector<int>(10));
or are there any more elegant ways?
 
Xeo: no it's not trolling...
 
@Nils Assuming you're extremely very sure that you really want a heap-allocated vector (WHY?): hopefully_a_smart_ptr blah(new std::vector<int>(10)); std::vector<int>& bleh = *blah;
 
@Nils err... vector<int> *blah = new vector<int>(10); ???
 
@LucDanton Well I can't allocate it on the stack and then return a reference to it
 
@Nils Return by value then
 
10:51 AM
@Raze I want a reference not a vector
@LucDanton assuming the vector is large it's not a good idea
 
@Nils What does your profiling reveal then?
 
nothing now, but it will get large
 
Can you move it?
 
@Nils You're doing Evilâ„¢
 
I mean, vectors are movable, right?
 
10:52 AM
so what am I supposed to do?
 
blah is a 'reference', unless only a reference variable will do. you can return blah.
 
sbi
@Nils Usually you don't.
 
@Nils Return by value
 
*blah is the vector.
 
yes
 
sbi
10:54 AM
@Nils What problem are you trying to solve with that ill-fated attempt?
 
@LucDanton so if it has 10M elements and I return by value those 10M will be copied, right?
 
@Nils Maybe
 
lol
 
@Nils, use a pointer to the vector if you want to return it. have the pointer point to a value assigned by new, like my example. You CAN return blah, which is a pointer to the vector, and not the vector itself.
 
sure
or I could return a reference to the dereferenced pointer
:D
 
sbi
10:56 AM
@Nils: I'm going out for lunch now, but here's one last statement before I do so:
Allocating a std::vector on the heap is almost always wrong.
I'll be back in ~60mins.
 
enjoy
 
@Nils depending on how you're assigning it, it might make a copy.
 
humm
u mean that vector<int>& a = createVector(); may not copies it?
 
@Nils I wonder why you would want to do it this way. Heap requires cleaning up.
 
@Raze yes it just requires cleaning up, I don't see a problem with that
 
11:08 AM
@Nils But I still wonder what you'd gain out of doing this.
Can't imagine why you'd want it in the heap in the first place.
 
1. I need it like all over the place.
2. It's large.
 
Check the time it takes to create the vector as compared to returning it
(I'm sorry for the gettimeofday crud but that's C++03)
 
@LucDanton thx, that's a good example
 
@luc: always gave a good example.. no doubt
 
@Nils Note that my results are not guaranteed to happen on your platform! But always measure first.
 
11:15 AM
sure
 
@Nils How about defining it in the topmost function where you require it? If its large, its ok because even if you create it like a normal object 'in the stack', the actual contents will still be in the heap. only the length and and a ptr to the array and such should be on stack.
 
@LucDanton And note that you're also measuring the time it takes to generate all those random numbers which might be skewing the results.
 
@MartinhoFernandes This is why there is a mid-point: you can see the time it takes to fill the vector, and the time it doesn't take to not return the vector thanks to NRVO.
Double negatives aren't always not funny!
 
11:35 AM
humm @Raze so you are saying even if the vector object itself is on the stack it allocates memory on the heap which is free'd once the deconstructor of a vector is called.
in this case heap makes no sense
how can I write raw data into a vector
memcpy(&myVector[0], something) ?
guess that this will crash
 
@Nils If the vector is sized correctly beforehand and the data you are writing has a valid format for the type, that is valid. I often use that with unsigned char.
 
Good afternoon
 
@AProgrammer cool will do that
@Robik hi
 
I've a problem, i can't make character rotated to cursor :(
I am not good at math :/
Maybe you cna tell me what's wrong here?
double rotate = (float) (atan2(mx, -my));
	    ship.SetRotation( rad2deg(rotate) );
The problem is that ship rotates very weird
 
www.stackoverflow.com
 
11:41 AM
Yeah., i tried to look there, but only 3d maths
 
I see
so the logical choice is to post it in the chat instead?
 
Well, i don't even know what operation is that
 
@AProgrammer So what I could do is write a function which takes a reference to a vector. Then call myVector.resize(nElements) and then put data in it
 
@MartinhoFernandes Thanks! :/
 
11:44 AM
hello again
 
Go and vote for C++0x to be made a synonym for C++11: stackoverflow.com/tags/c%2b%2b11/synonyms
 
@Nils That is a usable technique. But from personal experience with a library which abused the "write in a reference parameter instead of returning a value" technique, it can be very painful for the library user.
@jalf That will have to wait. I don't have enough points on c++11 for that. If you suggest the reverse direction, people like me which have points on c++0x will have the possibility to vote.
 
0
Q: Direction to angle

RobikHello folks. I'm not very good at math and I've a problem: I'm trying to make sprite always rotated to mouse cursor. That's what i have: // mx is mouse X and my is mouse y double rotate = (float) (atan2(mx, -my)); // Set rotation takes rotation in degrees sprite.SetRotation( rad2deg(rotate)...

 
@AProgrammer but the other direction doesn't make as much sense ;)
 
yeah
the trouble is that we have virtually nobody eligible to vote
 
11:55 AM
Well, let's keep tagging with . Eventually enough people will gather enough points.
 
We only need what, 4 or 5 votes though. Should be manageable
Besides, we've plenty of time. It'll be months before the c++11 name is official anyway
 
I don't see a direction in the general definition of "is synonym". Is there a difference for SO?
 
@AProgrammer See here: stackoverflow.com/tags/synonyms.
There's the idea of a master, and a synonym.
 
@MartinhoFernandes, thanks.
 
sbi
12:21 PM
@MartinhoFernandes We now have 15 people who can vote on c++11 tag synonyms, most of which are regulars here. What more do you want? If those people can't get 4 upvotes, the synonym idea must be flawed.
@MartinhoFernandes Actually it's one master and n synonyms.
BTW, Roger Pate again posted a comment reply to my SO rant.
 
@sbi hmmmm
 
 
1 hour later…
sbi
1:43 PM
Hi @Konrad!
 
hi @sbi
 
hi hi
 
hi all
 
sbi
Hi @jalf!
Is everybody coming this minute?
 
sbi
1:45 PM
Ha, I just bumped myself into the C++11 top-ten by adding the c++11 tag to a few C++0x questions I have been answering. :)
Tomorrow I should be one of the C++11 gurus here.
 
@sbi :)
 
sbi
Well, except that now that I spilled the trick you lot will rush to surpass me... :(
 
@sbi I won't, cause I haven't answered many C++0x questions
 
sbi
@TonyTheTiger Oh, I have only two dozen: stackoverflow.com/search?q=user:140719+[c%2b%2b0x]. But I carefully picked the most upvoted ones. :)
 
gah, dropping to #6
 
1:48 PM
That's hilarious, everyone has overtaken me
 
@sbi hehe
 
sbi
@TonyTheTiger You have two, with a score of ten: stackoverflow.com/search?q=user%3A174614+[c%2B%2B0x]. Believe it ro not, that would currently get you among the top ten, too.
 
@sbi so I'll just tag them then?
 
sbi
@TonyTheTiger I already did so. :D
 
@sbi thank you :)
 
sbi
1:56 PM
@TonyTheTiger Well, except you won't be among the top ten tomorrow, because the reason it's so silent here now is that everybody is busy tagging their most-upvoted C++0x questions c++11, so we will end up not even being in the top twenty...
 
@sbi ugh :(
 
sbi
How does one inline tag links here?
Ah. It's [tag:c++11].
 
it only matters temporarily though, since c++0x is becoming a synonym
ooh, handy
 
sbi
I shall try to remember that.
 
interesting
 
1:58 PM
woo
 
sbi
@jalf Now did you really have to pick goto?
 
sbi
@TonyTheTiger Haha! There's no question tagged , though. :( Who will change that? :)
 
was the first thing I could think of ;)
 
1:59 PM
you got no questions tagged yet @sbi... maybe on meta?
 
[tag: considered harmful]
 
sbi
@jalf I like @Tony's first much better! :P
 
No nested tags!
 
02:00 - 14:0014:00 - 23:00

« first day (212 days earlier)      last day (4721 days later) »