« first day (524 days earlier)      last day (4425 days later) » 

12:00 AM
I mean, how absurd is that? Is there a scale for absurdity? This ranks pretty high.
 
and in this case bool isEqual( const Object & ) const; the references are const, and the member variables cant be changed. correct ?
 
@rogcg You are still going on about this?
 
no, its another doubt, Im just taking some doubts here, to make it clear.
im doing some exercises
 
Unfortunately const methods don't give you any guarantuee since they can change mutable members and they can change member variables by using const_cast.
 
got it.
 
12:04 AM
However, const methods are still a good practice. And you should not use mutables or const_cast unless you really must.
 
got it
 
hmmm should i make another variable :S
 
I like to avoid variables.
 
dude, i have a lot to learn about c++
 
It's a long journey. Unless you are crazy like some of use here. (Not me. I'm a slow learner.)
 
12:07 AM
@StackedCrooked Do you know what we're talking about lol
 
@Beginnernato Not really. I just like to avoid having too much state in my programs. State is where the bugs are.
 
wheres the function that's basically istream >> char*?
 
Haï guys.
 
@Beginnernato What would this variable be?
 
12:10 AM
@MooingDuck getc or something?
 
@MooingDuck If you mean getline, it's in <string>.
 
@StackedCrooked No I mean, I thought it was a member function of basic_istream, but I can't find it (MSVC10)
 
There's std::getline, std::basic_istream::getline, std::basic_istream::read.
Use the first or the last.
 
@RMartinhoFernandes To check if it went in the condition where a[i] == b[j] therefore i'd increment say "x" and if x > 0 then i would set j = 0 and not iterate i ? .... But im realizing this isnt gunna work :S
 
getline for text, and read for binary data.
 
12:12 AM
There's no function to >> into a buffer of chars?
 
whats the deal when you declare a function like this string &function()..., why this reference??
 
There is istr.get();
 
@MooingDuck basic_istream::read.
 
@EtiennedeMartel I can't words :/
 
You can't words?
 
12:13 AM
@rogcg it returns the string by reference. I dunno why people put the & there
 
@MooingDuck Sometimes it's useful if you want your getter to double as a setter.
 
char buffer[32];
std::cin >> buffer; //you're all telling me this doesn't compile?
 
@MooingDuck u mean it returns the address of the string in the memory, right?
 
@rogcg yes
 
@MooingDuck It does, but it's a very bad idea. What if there's more than 32 characters?
 
12:14 AM
@EtiennedeMartel I understand why there's a &, I don't know why it's touching the variable name
@EtiennedeMartel in this case, I'm trying to "pass through" a function where a user has done just that. But I don't know what function to call.
 
so in this case pastebin.com/43MFZqgw it assigns the address of the returned string to another pointer??
 
operator>>'in shit directly in a char buffer has the same problem scanf("%s") had.
 
@rogcg You are returning a local variable by reference. That's aweful!
 
@EtiennedeMartel I'm aware it's a bad idea, I wish to know what the function is anyway
 
12:15 AM
@rogcg yes, which isn't allowed
@EtiennedeMartel I... ug... fine. I'll find it myself.
 
Maybe if you explained yourself better.
Because I can't really do much with an XY problem.
 
@MooingDuck What function? What does the function you're looking for do?
 
@MooingDuck why it isnt allowed
 
@rogcg A little insight into stack anatomy makes it easy to understand why this is wrong.
 
fun twitter war: storify.com/charlesarthur/oh-hai-sexism (courtesy Hanselman's Zen)
 
12:18 AM
@rogcg According to the C++ spec it is simply undefined behavior. In practice it is likely that the value will be overwritten by the local variables in the body of the next function call.
 
it should be std::string * str = a.getValue(); correct?
 
2130
A: Can a local variable's memory be accessed outside its scope?

Eric Lippert How can it be? Isn't the memory of a local variable inaccessible outside its function? You rent a hotel room. You put a book in the top drawer of the bedside table and go to sleep. You check out the next morning, but "forget" to give back your key. You steal the key! A week later, you retu...

Don't steal hotel keys.
 
@rogcg If you are returning a local variable then it should be: std::string getValue();.
std::string str = a.getValue();
If you are returning a member then you can return a const ref.
 
@RMartinhoFernandes I just wanted to know if this function: "basic_istream<_Elem, _Traits>& operator>>(basic_istream<_Elem, _Traits>& _Istr, _Elem& _Ch)" was a member or not :(
 
why?? still dont get it.. =(
 
12:21 AM
@rogcg because outside of the function it doesn't exist anymore
 
@rogcg Because local variables don't exist anymore once the function ends.
Keeping a reference to something that doesn't exist doesn't make sense.
 
ohh got it!! the address in the memory has been destroyed
 
I do appreciate all the help you guys offered though. I recognize the failing was my communication skills.
@rogcg .... close enough yes
 
Not necessarily, the book may still be there.
 
@RMartinhoFernandes don't confuse him :(
 
12:22 AM
But you shouldn't be stealing keys.
 
dude, this is getting really exciting. =)
 
@rogcg The address in the memory has been destroyed?
 
@MooingDuck Sorry, I'm a pissed off at something else...
 
I mean, it doesnt exist anymore, due to the fact that the variable doesnt exist anymore
sorry.. i mean
u got it, I just dont know how to explain
 
what the... part of my error message from MSVC is could be 'built-in C++ operator!=(const char [7], const char [7])'
 
12:23 AM
but I understood it
 
@rogcg The location where the variable used to be may be occupied by something else now.
 
we can compare arrays with == and !=?
 
yeah
thats it
thanks for this explanation, this was the words I was looking for
 
@MooingDuck Is that an overload resolution candidate listing?
@MooingDuck No, there is no such built-in operator. Either MS extension, or just buggy.
 
Sleep..
 
12:27 AM
@RMartinhoFernandes yes
 
@RMartinhoFernandes I'm trying to compare a std::basic_string<e, t> and a const e(&sliteral)[N]. Not sure why it seems to think the left side is also an array...
GCC compiles my code fine
 
@EtiennedeMartel It's a bunch of people on a street. Not really seeing the picture-worthiness.
 
@DeadMG If by "a bunch", you mean "200 000", yeah, indeed.
I share that because I was actually in there somewhere.
 
12:30 AM
the raw value of the number of people is quite irrelevant
 
What were you protesting against?
 
@DeadMG That's roughly half of Quebec's higher education students.
 
Hmm, if I have a stupid error in MSVC that baffles me, do I post a link here, or do I make a SO page? Both places seem the wrong place. Maybe I need to find me a help site. codereview or something
 
@RMartinhoFernandes The government decided to raise university tuition by 1625$, or 75%, over five years. We have a fairly strong social democratic tradition in Quebec, so, yeah, we got angry.
 
Questions about stupid MSVC errors seem rather common.
They're perfectly acceptable.
 
12:32 AM
plus someone gets rep! alright.
 
dude, I just dont know how to use Dev C++. LOL!!
 
@EtiennedeMartel Oh, the raise alone is more than I pay.
 
@EtiennedeMartel The general state of things suck, and students are well-known for protesting, so I'd expect to see large student protests.
the only thing that surprises me is that it's only half
 
@DeadMG The rest were busy studying, obviously.
 
our tuition fees went from £3.5k to £9k a year here in the UK
lead to some nasty protests/nearly riots amongst students
 
12:33 AM
Ow.
 
Yeah, that increase was insane.
 
especially since our universities suck a massive pile of balls
an opinion that it is no surprise that I hold, of course
 
if I was in charge, I would force them to offer every course to everyone online at cost
 
If I was in charge, I'd get someone to take care of it and have some vacation.
 
12:36 AM
rofl
 
What? I'm being responsible. I am totally not fit for being in charge, so I put someone that is.
 
I am totally fit to rule the multiverse UK
 
what the heck? MSVC is totally confusing me now
Interesting. If I don't include string, then MSVC compiles std::basic_string<e, t> as something that converts to an error_code or error_condition. Thoughts?
 
I think that you need to #include <string> if you want to use basic_string
 
@DeadMG yes, but why wasn't there a error message besides the "ambiguous function call"?
 
Xeo
12:45 AM
0
A: Promotion of C++ overloaded function pointer to a function object

XeoFor function pointers, you can simply have the user type the signature: template<class F, class T> void foo(F f, T x){ f(x); } void bar(int){} void bar(double){} int main(){ foo<void(int)>(bar, 5); } Live example on Ideone. foo will be void foo(void f(int), int x) after subs...

Any idea why my get_overload fails if I simply put F as the return type?
 
@KonradRudolph oh, that question of the day Twitter account is a lie. Sometimes it takes two weeks between tweets.
 
class A
{
    public:
        A();
};

int main()
{
    A *a;

    cout << a << "\n";

    free(a);

    cout << a;

    system("pause");
}
it didnt made any difference.
 
@MooingDuck Who cares?
 
the memory address are the same after free keep the same
 
That is using a uninitialised.
 
12:47 AM
should it be dealloccated?
 
free doesn't modify the pointer.
 
the compiler doesn't have to do anything sane if you don't include the Standard header that defines the class you need to use
 
the docs say: "this function leaves the value of ptr unchanged, hence it still points to the same (now invalid) location, and not to the null pointer."
what it means by "now invalid"??
 
@Xeo Can't return functions.
 
It means exactly what it says.
 
Xeo
12:49 AM
@RMartinhoFernandes D'oh. Nice, thanks.
 
@Xeo GCC gives me: error: function returning a function
 
Xeo
Ideone just says "meh, deduction failed. Mooo"
Same with Clang
 
Which is quite obvious.
@Xeo Woah, a GCC error more clear than Clang's?
 
@CatPlusPlus so what about the INVALID.. the address is still being used or not??, It just points to the address but is not being used?, I dont get it..
 
@TonyTheLion Amusing read
> I'd move. This guy is like a pressure cooker. One of these days he's gonna snap and turn your skin into a suit he'll wear so God can't see him watching 'inappropriate videos'.
> > The amount of crazy that you just casually threw out in that sentence was staggering. Bravo.
 
Xeo
12:51 AM
@RMartinhoFernandes Well, we'll just need to tell the guys over at #llvm and it's fine.
 
@DeadMG I am dumb. The other includes included basic_string, but not the operator I was using. It's so obvious.
 
It means it cannot be used.
 
Whiskey makes me intolerant for lack of reading comprehension.
 
@Xeo What do you use for IRC?
 
Xeo
mIRC
 
12:52 AM
got it
 
Oh Windows.
@sehe what do you use for IRC?
 
@RMartinhoFernandes IRC? You mean, Internet Relay Chat? I don't use it
 
Xeo
lawl
 
why when in the last code I post, if I do A *a = new A(); it says, undefined reference to A::A(), any idea?
If I defined a default constructor
yeah
I just defined
I forgot that if I dont define, the compiler defines one by default, now it works
 
@RMartinhoFernandes When I tried using it it was Android NAndChat and I did use Pidgin before.
 
12:57 AM
@RMartinhoFernandes I've used Pidgin a few times, it was ok
 
some of you already installed ubuntu 12.04??
 
@RMartinhoFernandes I had to actually go and chroot into my maverick 32 bit install that I keep on backup in order to find that out. Xephyr for the world :)
 
@RMartinhoFernandes :)
 
Oh, it's midnight already.
No, one o'clock.
Damn.
 
1:00 AM
@RMartinhoFernandes 2am, here
 
Where are the last 3 hours? Who took'em?
 
How can this code be used for STL containers.. I mean concepts..
template< class InputIterator, class OutputIterator >
void copy( InputIterator first, InputIterator last, OutputIterator out )
{
   while( first != last && ((*out++ = *first++) || true));
};
 
Ew. Where's that from?
 
@rogcg What's the problem (besides the obvious obfuscation)?
 
What's the || true for?
 
1:02 AM
@EtiennedeMartel To make it fit unconditionally in the while condition
 
@EtiennedeMartel So it always returns true.
 
Why not just put the *out++ = *first++ in the body?
 
But that code has an extra requirement it shouldn't have. It requires the value type of the output iterator to be convertible to bool.
 
Well, actually, to make sure the loop continues even if the result of the assignment to the derefenced output iterator yields 'false' (after optional implicit conversion to bool)
 
@sehe It's contextual now!
 
1:04 AM
It's still ugly.
Ugly as fuck, actually.
 
@RMartinhoFernandes why it must be convertible to bool?? the result of the operation should make it already
 
@rogcg Really, why?
 
I just would like to know how can it be used for STL containers
 
What if I have a vector of std::strings?
The result of that won't be convertible to bool.
 
oh yeah, thats an assignment.
 
1:07 AM
@rogcg In general, it can't. Precisely because of the unnecessary requirement of conversion to bool.
while( first != last) *out++ = *first++; works fine.
 
'yeah
so basically it cant be used for STL containers?
 
In can for some. It works for vectors of ints, for example. But in general it doesn't.
 
Xeo
I wandered into the weird part of youtube again. :(
 
AND YOU LINKED US TO IT?!
 
Xeo
:3
 
1:16 AM
DAFUQ IS DIS????????!!!!!!!!!!!!!
 
Xeo
Better than TVTropes, isn't it?
Also, it was programming related. They played suicide in C#!
 
Man, I suck. I knew what I was getting into, but I clicked both links...
I can't help it.
 
@RMartinhoFernandes Sluuuurp
 
Xeo
@EtiennedeMartel Is that his time getting sucked away by both links?
 
@Xeo No, it's what I thought when he wrote "I suck".
 
1:29 AM
hi. could someone please explain how to use the qsharedPointer?
been trying to read up on it but i makes no sense
 
@chikuba Like a boss?
 
huh?
on the qscopedpointer they give examples
but to for the shared one
the thing is that i allocate a qfile in one function where i want to wrap it in a smart pointer if i got an exception
then i want to send the pointer to this other file, which creates an object that will become the owner of the file
not*
gosh, i ment that i want to send the file to a function in another CLASS
 
If the file is never shared, then a QSharedPointer might not be the best solution.
 
and there it uses it do create an object, using the file
 
But, yeah, perhaps you should all write this in a SO question, then put a link here to the question.
 
1:34 AM
but how do you pass a shared pointer to other functions?
 
The chat is illsuited for that kind of things.
 
ive done it like 2x, as a sidenot "please help with this too"
 
Woo, I got out. That was easy.
 
1:46 AM
Got out of what?
 
Oh. Impressive.
Teach me, master!
 
if the exercise askk to print the elements of a vector, without using indexes.. and I fetch it like this

for(iterator = v.begin; iterator != v.end(); iterator++)
{
cout << *iterator << endl;
}

Im doing it correctly, right?
 
@rogcg std::copy(v.begin(), v.end(), std::ostream_iterator<T>(std::cout, "\n"));
 
why?
 
1:52 AM
@rogcg And no, v.begin should be v.begin()
@rogcg Because you asked?
 
yeah, I misstyped it
but the way I did, isnt correct?]
 
@rogcg Ok, well it works, too then :) I prefer ++iterator instead of iterator++, for continued pedantry
@rogcg Your loop is the archetypical forward iterator loop, yes (aside from the postincrement)
 
but its correct when it say not to use indexes
 
Well, yes, considering vector iterators are not indexes.
 
what if I have a struct, and I have a vector of typo of this struct, and I want to print a specific attribute of this struct with iterators. How would I print it.
 
1:55 AM
@rogcg Dereference the iterator like a boss pointer:
cout << (*iterator).attribute << endl;
or
cout << iterator->attribute << endl;
 
dude, pointers are awesome!
 
@rogcg <whisper>better not mention that in this room</whisper>
Also, relevance?
Textbooks are awesome!
 
IDK
 
@rogcg No.
 
@ScottW beh
@ScottW no, that is rdkdkdkrk rdkdkdkrk
 
2:01 AM
what is this error
no match for 'operator<<' in 'std::cout << (&iterator)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* [with _Iterator = const item*, _Container = std::vector<item, std::allocator<item> >]()'
 
Xeo
@EtiennedeMartel First, thou must enter the dungeon. And then thou hast to get lost.
 
when trying to do cout << *iterator;
 
@rogcg It means that you cannot '<<' something. Pretty sure it isn't *iterator
 
what should it be then. its the only thing im '<<'
 
@rogcg pastebin it? I'm not psychic
 
2:03 AM
@sehe ROFL!!
 
@rogcg oh, that's a freaksih message saying 'wut? how to print item'
 
???
 
You have not supplied an overload of operator<< for item.
 
Xeo
I wonder if my latest attempt to trap somebody worked.
 
@rogcg more or less what you figured out. What do you expect to print?
 
2:07 AM
the items in the vector
 
@Mankarse Like
 friend std::ostream& operator<<(std::ostream& os, const item& o)
 { return os << "{ i: " << o.i << " name: " << o.name << " }"; }
 
thats why Im '<<'ing the *iterator
 
@rogcg But how? What you do expect to print, literally? What layout? What values?
@rogcg At least, trying to :) Why don't you use iterator->i << iterator->name as mentioned before?
 
@sehe Oh I see dude.. I should have passed (*iterator).name, as mentioned before
 
13 mins ago, by sehe
@rogcg Dereference the iterator like a boss pointer:
 
2:08 AM
yeah, I tryied it here
 
:)
 
sorry for my incovenience
 
@rogcg it's ok. Drop the friend operator snippet inside the item struct for kicks too, that will show you how you can overload operator<< and profit
 
got it!
 
@rogcg Using a little c++0x you could even write for(auto& i : v) cout << i << endl;
happy learnings :)
 
2:12 AM
thanks.
 
@Xeo care to elaborate? edit oh, tropes
 
hey what do u guys think about python?
 
@rogcg it rocks. like many other languages
 
good.
 
2:29 AM
like a baus!
 
@DeadMG :)
on that note, off to bed.
 
@RMartinhoFernandes it's 2:29am at your place now
 
Thanks. I have clocks.
 
really? I presumed you lived in some sort of timeless void
 
2:34 AM
That's the thing for supernatural entities. Robots are based on the laws of physics.
 
aha
why do I insist on eating things that make me sick? :(
 
Got a question, regarding ostream and streambuf. Why is it that when using ostream that you need to pass it, its own streambuf or does it maintain its own stream if streambuf is not provided?
 
2:53 AM
Well that was surprisingly easy.. just created my first software RAID on fedora
 
3:17 AM
lol
I always like to yell "TADA!"
 
It's only going to take 23 hours to finish building!
 
Xeo
@Etienne: You fine? Still alive? Or lost in the dungeon? :)
 
@Xeo Messing around with Win32 critical section.
 
Xeo
Dammit
And there I hoped I had trapped you. :(
 
No, I need to work on my project.
Well, "work" might be the wrong word, considering I spend my time rebuilding the whole thing.
Did you know that critical sections actually contain debug information that you can turn off with a flag on InitializeCriticalSectionEx? But that this function only exists on Vista and later?
Our profiler reported multiple calls of IntegerToUnicodeString when acquiring the critical section. I think it comes from that.
 
3:28 AM
Fantastic.
 
(Warning, incoming caps)

FUUUUUN INDEEEEED.
Oh, and now I put a breakpoint in a constructor, I run the shit, and then the breakpoint mysteriously jumps to the destructor. Well well.
 
idiot VS bug?
 
only a couple letters is all
 
Then again, I run the code in release with both optimizations and debug information turned on. So, working as intended, I suppose.
 
Xeo
3:44 AM
Debugging in release mode? Bad idea.
 
Yeah, everyone knows release code has no bugs.
 
In our case, debug code is ridiculously slow.
At one point I think I added a feature that caused the frame rate to drop by 90%.
I'm awesome.
 
Stupid dorfs, Y U DRINK ON OTHER SIDE OF RIVER?
 
Because they're stupid?
Have you tried using non stupid dorfs?
 

« first day (524 days earlier)      last day (4425 days later) »