« first day (292 days earlier)      last day (4649 days later) » 

3:00 PM
@kbok Cheater.
 
But I was refering to KiWiKaKi.
 
@MartinhoFernandes Hate the game, not the cheater.
 
OK, so what’s going on here?
5
Q: Function member pointer with private base

SerbanLupuThe following code yields a compile time error: 'base::print' : cannot access private member declared in class 'base_der' However, I have made the member public in the derived class. Why doesn't this work? #include <iostream> using namespace std; class base { public: int i; ...

 
Eh
Anyone heard of the "C++ Complete Reference"?
 
@KonradRudolph is the private inheritance-answer incorrect?
 
3:10 PM
Ugh, it's from Herbert Schildt.
 
Is that any good?
 
@StackedCrooked No, it’s wrong
 
I don't think so
 
@MartinhoFernandes I guess that says it all
 
OP’s code is using the base member, and therefore explicitly pulling it into public scope
 
3:11 PM
:( can't use Amazon look inside.
 
> Nope. I're wrong. I grant public acces to functions "print". I read about that in C++ Complete Reference. If i use the block commented in main function is working.
 
at least as far as calling is concerned
 
574
Q: The Definitive C++ Book Guide and List

grepsedawk This question has historical significance, but is not a good example of an appropriate question. Read and learn from this post, but please do not use it as evidence that you can ask similar questions. See the FAQ for more info. Provide QUALITY books and an approximate skill level. Add ...

if it's not on there, it's probably a shite book, or really new
 
@DeadMG Schildt = shite book, alright
2
 
I think that Sutter is due to do an Exceptional C++11, or thereabouts
 
3:14 PM
what happened to @TonyTheTiger?
 
Writing a blog post about tits, I think.
 
… the birds, right?
 
Flippin' it.
 
@KonradRudolph Seems like you don't know who we're talking about :)
 
@Martinho I’m comfortable in my ignorance. More so if you’re not talking about birds. ;-)
 
3:17 PM
0
Q: Are moved-from objects required to be destructed?

FredOverflowIf I move-construct a from b, is it still necessary to destruct b, or can I get away without doing so? This question crossed my mind during the implementation of an optional<T> template. Excerpt: ~optional() { if (initialized) { reinterpret_cast<T*>(data)->~T(); ...

any insights?
 
> Busoms, melons, milk factories, busts, funbags, knockers, ballistics, boobies, jugs, nipples, jubblies, stonking great tits!
 
C++ The Complete Reference seems promising: "Part1 The Foundation of C++: The C Subset"
 
As the great Ben Croshaw said.
@MartinhoFernandes Oh dear.
 
@FredOverflow That's a really really weird question.
 
Very well organized: "Chapter 14 Function Overloading, Copy Constructors, and Default Arguments"
Someone thought lumping those three together was a good idea.
 
3:19 PM
Well
Overloading and default args makes sense
Copy constructors, eh
 
@LucDanton Is it unclear?
 
@FredOverflow The way it's phrased it's like you expect someone or something to put a requirement on move constructor. Is that the case?
 
Well, I'm sure the standard says something about it...?
 
@FredOverflow Answered with an example on how your question seems somewhat nonsensical to me.
Also I don't want to dive into the Standard to check it but I'm pretty sure the only requirement the Standard puts is in the guarantees of the Standard types. Nothing is said about user-defined move constructors; the same way user-defined copy-constructor are never required to make logical copies.
 
uh
by that, you mean the user-defined copy constructors where the Standard explicitly allows eliding them as if they only ever made logical copies, even if they don't?
 
3:28 PM
Yes.
 
because that sounds exactly like a requirement to only make logical copies to me
 
Wait no.
They're allowed to be elided no questions aked, there's no as if guarantees at all.
i.e. instrument your copy constructor to output to std::cout, you may never see anything on standard output.
 
that's exactly my point
the compiler is legally allowed to assume that all you ever do is copy the object
which to me sounds exactly like a requirement that that is exactly what happens
 
No it isn't.
The compiler is allowed to not call the copy constructor. That puts no requirements on what the copy contructor does.
 
if your program depended on it doing something other than copying, then you're screwed
how is that not a requirement?
 
sbi
3:32 PM
@TonyTheTiger Ok. (Where are you now?)
 
@DeadMG It's not a requirement put forth by the Standard because it doesn't appear in the Standard. What you mention ("if a program ...") is a consequence.
 
That's so messed up. Tigers don't eat cereal.
 
@DeadMG Like you say, if you depend on that it's your own dumb fault.
@Xaade Tony does.
CopyConstructible requirements: T u = v; does not change v and makes u equivalent. T(v) same thing. Not a requirement on copy ctors, but on types that have this concept.
 
@DeadMG That is to say, there are valid programs that use copy-constructors that do more than a logical copy but are logically sound even when a copy is elided.
 
@Xaade Everyone has to pay the rent at one point.
 
3:35 PM
std::shared_ptr comes to mind.
 
@LucDanton It also isn't a requirement, technically, that std::string stores it's memory contiguously- just in reality, it pretty much is because there are a shitbunch of functions where it suddenly has to become contiguous and in reality everybody has to make it contiguous
@LucDanton How is copying a shared_ptr not a logical copy?
 
Nevermind, use_count is part of the invariant.
But imagine a similar shared-ownership pointer where the use count is not part of the public interface.
Eliding a copy changes the internal details of the program.
 
no
a logical copy is a logical copy, regardless of the accessibility of the logic involved
 
@DeadMG Yes, that's why I have to present to you a case where the copy constructor does not strictly do a logical copy. However I'm only coming up with lousy examples.
I'll first answer Fred, then I'm going to think about a better example.
 
that's because no examples exist
 
3:41 PM
There's the classic example of the class that assigns a unique ID to each instance.
T t; /* first T of the program: t.id() == 1 */
T make() { return T(); }
 
So, that class cannot be CopyConstructible?
 
int main() { assert( make().id() == ?? ); }
 
you mean the classic example of the class that's trying to re-invent pointers?
 
@MartinhoFernandes Maybe. For some value of 'equivalent'.
 
I don't know how the standard defines equivalent.
 
3:44 PM
@DeadMG Does this example make my point clear?
 
no, because you could never write an assert that would work
 
@MartinhoFernandes FWIW I'm not using any Standard facility in my example program that uses the CopyConstructible requirement anyway.
 
so I don't see how you could possibly suggest that it's valid
 
My point was that as long as you don't write a program that rely on a particular value for id, it can still be a useful C++ program even in the face of elisions.
So yes, that one with the assert is silly.
 
then how is it logically part of the class if the class doesn't rely on it?
 
Als
3:46 PM
Hello
 
@DeadMG That's the wrong question. I can write an implementation of std::vector which doesn't rely on the fact that &*begin() == &operator[](0) but that doesn't mean begin is not logically part of the class.
 
no, but it does mean that that particular identity is not
 
Oh okay.
Then why do you say T::id is?
The only guarantee I've presented to you is that t.id() is unique for each given instance of T.
 
no, I explicitly said that T::id wasn't
 
Copy elisions don't break the invariant that each instance has a different id.
 
3:50 PM
no, you also said that the program doesn't rely on any particular value or ordering of id
which is what allows ellisions to not break the logic
 
I don't know, I feel you're being unfair here.
I present to you a class with a copy constructor that does more than a logical copy.
That's what matter isn't it?
 
not really
firstly, you've presented a class which reinvents a language feature, give or take
which is hardly in the realm of reasonable, probable code
 
@DeadMG It's an example.
 
and secondly, whether or not it actually does do more than a logical copy is something that I am debating
because I'm saying that it doesn't do more than a logical copy
 
@DeadMG The typical example program is Hello World which is hardly in the realm of reasonable, probable code.
@DeadMG It assigns a new unique ID to the new instance.
 
3:53 PM
I'd say that the help function in a lot of CLI applications is pretty damn close to Hello World
 
@DeadMG Hello World doesn't deal with localization.
It doesn't detect whether there is a device on std::out or not either.
It doesn't do plenty of things a real application does.
The typical Hello World of functional programming is even fucking factorial.
How is that reasonable, probable code?
It's an example.
 
the difference is that you only need to add to Hello World to make it a real example
 
Come off it!
 
whereas I'd be taking code away - specifically, all of it- from your example to make it a real program
 
Do you mean
You wanted to ask: "Is there a real use case for your example"?
 
3:55 PM
and, the important part is that I think that it doesn't perform anything other than a logical copy
 
Instead of your 'reasonable, probable code' nonsense?
@DeadMG I agree it's the important part of your side of the argument.
Stop addressing unrelated details seriously. Of course some examples are not 'reasonable, probable code'. The point is to extract what is relevant and salient to the discussion. I won't exhibit a real program in a few lines of chat. How unreasonable is that?
@DeadMG The IDs of instances of the class could be GUIDs that are globally unique accross a network of machines.
 
still don't see how that's not a logical copy
 
Given T& t1 = ...; T& t2 = ...; if you have t1.id() != t2.id() then you know they're not logical copies of one another.
 
not necessarily
you'd know they weren't bitwise copies of each other
 
Wait you're right I'm not sure what I wanted to convey here.
 
4:04 PM
I could equally argue that if I had a memoized function and two copies of the memoize cache, that doesn't make the functions not equal
 
The difference always holds here.
 
t1 and t2 could refer to the same object
 
So if t1.id() == t2.id() then you know &t1 == &t2 but I doubt that's useful to my point.
I think the only thing that matters in my example is that the copy constructor does a non-trivial side-effect.
So when you said
36 mins ago, by DeadMG
if your program depended on it doing something other than copying, then you're screwed
 
not really, we're just getting into the semantics of what a logical copy actually is
 
You didn't consider copy constructors that do a logical copy and more an issue?
 
4:08 PM
no
 
Well okay not the best example to present then.
 
what I'm saying is that if the class doesn't require any logical ordering to it's id(), then the id is just an implementation detail
just like caches, etc
 
Disregard that.
It's just that I read 'something other than strictly copying'.
You know, 'if' vs 'iff'.
 
I see
that's cool
 
'I have two cakes, thus I also have one'.
So notice that copy-elision can affect a useful program.
It's simply not an 'as-if' rule, there's already that. It's a further exception.
 
4:12 PM
0
A: Multiple characters in a character constant

Code MonkeyYou could use it in a case statement, I guess, but I wouldn't recommend it. 'yes' is a multicharacter constant. Its type is int, and its value is implementation dependent. So like you already stated, it's up to the compiler. so int foo = 'yes'; ARM, section 2.5.2, page 9: "A character con...

 
Als
hello...
 
Is this true in C++?
 
@MartinhoFernandes integer character constant has type char in C++
 
@MartinhoFernandes There are examples of such constants in Boost.MPL so I assume it is.
 
Als
I am a little confused with one of the questions i saw here..
Can anyone make any sense of this one.
4
Q: Function member pointer with private base

SerbanLupuThe following code yields a compile time error: 'base::print' : cannot access private member declared in class 'base_der' However, I have made the member public in the derived class. Why doesn't this work? #include <iostream> using namespace std; class base { public: int i; ...

 
4:16 PM
@Als maybe he needs to use friends
 
Als
Actually, I just played around with it and realized one cannot access private functions of base class publicized in derived by using notation through a pointer to derived class but can access them through derived class object .
@CodeMonkey: Strange behavior that confuses me, can get around it easily
make friend
 
@CodeMonkey "An ordinary character literal that contains more than one c-char is a multicharacter literal. A multicharacter literal has type int and implementation-defined value."
 
Als
or
use public derivation
 
2.14.3 Character literals [lex.ccon]
 
@LucDanton Yes, that's what I said in my answer
 
4:18 PM
@CodeMonkey That's from the C++0x FDIS though.
 
@LucDanton Maybe it's different for C++0x
 
Als
hmm..confusing...
 
@CodeMonkey Reference is 2.13.2 for C++03 and text is similar.
 
Anyone know of a better "works on my machine" than this
 
Little question about parallel prog
In the API I'm developping I have a read-write lock. Should I lock on the public API function or on the private functions of the API?
 
4:25 PM
@hexa You want better than that?
That one is awesome!
 
It is! But it's not transparent and has a lot of artifacts :P
 
@Francis Huh, I know this sounds stupid, but... You should lock where it makes sense to. You need to be more specific if you want a more specific answer.
 
I have a Works on My Machine shirt at home
 
@MartinhoFernandes Yea I know that
 
@hexa I one ripped one from the about box of this: defaultprogramseditor.com
I don't know if it was transparent, though.
@Luc: I've been considering your remark about me abusing specializations in my BitTorrent code. I came to agree when I started on the code to read messages.
 
4:34 PM
Adding code to the existing classes?
 
I cannot possibly know the type of a message until runtime. So what is the return type of read_message?
I rewrote the whole thing to use inheritance.
 
You can go the same route as Boost.GIL: stuff it all into a Boost.Variant and use a visitor to dispatch on the correct static type.
Unlike GIL, that would of course be wrong and a hack where inheritance would indeed be more natural.
 
I thought about variant, too. But I want to be able to support extensions, and inheritance is more flexible than variant.
 
it's not value-typed, though
so you may find yourself with a memory-management mess
 
Nah, messages are not long-lived. Read, dispatch to handler, discard.
 
4:42 PM
that's Kewl™ then
 
Als
treat for language lawyers
0
Q: Did Bjarne Stroustrup make a mistake?

xmllmxIn the book "The Design and Evolution of C++", Bjarne Stroustrup quoted a statement as follows: "Writing is the only art. that must be learned by wrote." (The first sentence in the first chapter) The word "wrote" seems to be misused in the context. I think "writing" should be the correct one. ...

 
not a real question
 
Als
@DeadMG: Thats about grammer....you wanted to improve yours eh..:P
 
not programming grammar
 
Als
:)
@DeadMG: Any thoughts on this one
4
Q: Function member pointer with private base

SerbanLupuThe following code yields a compile time error: 'base::print' : cannot access private member declared in class 'base_der' However, I have made the member public in the derived class. Why doesn't this work? #include <iostream> using namespace std; class base { public: int i; ...

The more I think on this the more uneasy I feel!
 
4:52 PM
I have already seen it and chose not to make an answer
 
Als
@DeadMG: Do you mean You know the answer but wont post it? :O
 
That's what Johannes does.
 
no, I mean that it doesn't interest me whatsoever, I don't know the answer, and therefore see no reason to attempt it
 
Als
@DeadMG: Agreed practically, hardly of any use but grrr it makes me uneasy..
@MartinhoFernandes: I know!
 
why does it make you uneasy?
private/protected inheritance is virtually never used
if I had a C++ compiler that crashed every time it was used, I'd prioritize almost anything else over fixing that
 
4:56 PM
virtual inheritance is protectedly never used.
 
Als
Yes, but just feel as if something amiss about knoawing it
 
Hmm, doesn't work very well like that.
 
Als
That tit guy @TonyTheTiger is here :P
 
"that tit guy". Genius.
2
 
Als
haha
 
5:00 PM
woah!! @Jalf gave me the most epic CV review I've ever had from anyone :) Thanks !!!!!
 
Did it consist of "It sucks."?
2
 
Als
@MartinhoFernandes: probably, IT sucks is more apt
:P
 
lol
don't think @Tony likes you referring to her as IT
 
Als
@DeadMG: You made the her part up you puppy!
 
5:04 PM
that's what makes it funny rather than insulting
 
@MartinhoFernandes Yeah.
 
@DeadMG her???
 
I'M CONFUSED.
 
I don't have a gf, unfortunately
 
Als
@TonyTheTiger: You are the her apparantly
lol
 
5:05 PM
@Als oh I've turned female now... kewl :)
 
@TonyTheTiger Problem solved!
 
Do you like your tits?
 
@MartinhoFernandes I LOOOOVVVVEEEEE my titties :P
 
@MartinhoFernandes Now, now, let's not get carried away, shall we?
 
oh god, what have I done?
 
Als
5:06 PM
@TonyTheTiger: Since this room consists mostly of pedantic & horny C++ geniuses, a her was needed!
 
@EtiennedeMartel this is the C++ room, we always get carried away :P
 
I leave you for 10 minutes and this happens. Tsk, tsk.
 
heheheh
 
Als
Ah Yet another she cat
 
Don't get your hopes up.
 
Als
5:07 PM
@CatPlusPlus: You got company now, it seems the he tiger is a she tiger
 
Als
@TonyTheTiger: Keep our claws off the rabbit!
I saw one @tkerwin entered the room just now..
 
This is not gonna end well.
 
Als
@EtiennedeMartel: Why are you sulking? something wrong?
 
@Als Nah.
But, dayum, there's no many animals in here.
 
5:11 PM
There's a code monkey
 
Als
@EtiennedeMartel: Atleast, there are so many peeps here now, I remember it used to be very few of us here before
@CodeMonkey: do you change your pic everyday?
 
so
if I want to buy some chocolate, I'll have to get dressed first
 
@Als I just changed it last night. It was Yeungling for about a year
 
@DeadMG TMI.
 
Als
@DeadMG: E-BAY
 
5:15 PM
There, I'm done coding for today. I think I'll put my dorfs to work now.
 
5:26 PM
Ugh /bin/sh^M: bad interpreter: No such file or directory
This one again.
:set fileformat=unix
 
5:40 PM
XAML editing in VS2010 is slowwwww....
 
I'm off, have a great day!
 
@ÓlafurWaage sent you what you requested :)
 
@EtiennedeMartel tell me your are not using the designer view?
 
@Drahakar Of course he is
 
@TonyTheTiger hope it's useful. If you want, I can send you the .tex code for my sample too
 
5:54 PM
I said XAML, not designer.
 
you know
I could implement axioms in "DeadMG++" as a library feature
 
@jalf oh man, it's very useful thanks a lot :) :) I don't know how to use .tex files :(
@DeadMG which axioms?
 
@EtiennedeMartel Did you turn your computer on and off?
 
Thanks, Mr. IT.
 
@EtiennedeMartel Could you do it again?
 
5:57 PM
@EtiennedeMartel who's that?
 
@TonyTheTiger It's like Mr. T, except he only gives bad computer-related advice.
 
@EtiennedeMartel lol, not sure who Mr. T is in the first place... so this doesn't really figure for me
 
oh I get it :)
 
@TonyTheTiger I pity the fool who doesn't know Mr. T.
3
 
5:59 PM
he plays world of warcraft @now : youtube.com/watch?v=bqJE5TH5jhc
 
@EtiennedeMartel can you pity me then?
lol
 

« first day (292 days earlier)      last day (4649 days later) »