« first day (706 days earlier)      last day (4467 days later) » 

15:01
@R.MartinhoFernandes Brainfart, I was thinking of std::string::resize there, likely
@TonyTheLion COMEFROM?
Maybe he's practicing for an obfuscated code contest
@DevSolar Well, the more legible version is ~30% shorter, lacks a cast and is otherwise equivalent. My question therefore stands: "What's the point of making it a oneliner?" — sehe 1 min ago
I liked the conversation between Alexandrescu and Herb in the last C++ and Beyond video:
Alexandrescu: "Why isn't make_unique in the standard?"
Herb: "It's an oversight."
Alexandrescu: "A big one.."

Finally someone said it.
@sehe is that a programming language or something?
COMEFROM basically means virtual methods. /troll
@StackedCrooked Hehe.
I suck terribly at bit manipulation
it always manages to confuse me
@TonyTheLion If you can't manipulate a bit then how are you even gonna manipulate a byte? It's eight times as big you know.
You have a point
for some reason, I can never get it right
15:09
@StackedCrooked hehe
Actually it just takes a little practice. You should create a list of 100 bit manipulation exercises ordered by increasing difficulty. If you'd do that then you'll do better than most of us here.
Oh please do, and send it to me so I can solve them after ;)
@StackedCrooked hmmm not a bad idea
@TonyTheLion The concept is called overlearning.
Overlearning is a pedagogical concept according to which newly acquired skills should be practiced well beyond the point of initial mastery, leading to automaticity. Once one has overlearned a task, one's skill level is higher than the challenge level for that task (see Control region in the graph). The Yerkes–Dodson law predicts that overlearning can improve performance in states of high arousal. Rohrer et al. define overlearning as “the immediate continuation of practice beyond the criterion of one perfect instance." Past research has referred to overlearning as an effective means of mo...
15:12
oh they even have a term for that?
In high-school I think geometry excercises where a form of overlearning. Remember the T-regels?
"Arousal" ?
lol no, because I didn't do high school in Belgium
"[...] overlearning can improve performance in states of high arousal."
lol
15:14
Odd enough, I did not found myself doing bit manipulation while aroused.
@netcoder What are you thinking about? :D
@kbok maybe it can help to prevent premature , er.. program termination.
@kbok I can't help but interpret one particular word in that sentence as if it was French.
@kbok But I did nibble manipulation, quite extensively
@R.MartinhoFernandes: good one ;-)
@R.MartinhoFernandes Which one?
15:16
@StackedCrooked The green one
found -> fond, manipulation -> manipulation.. ?
@StackedCrooked "bit"
@StackedCrooked: "[...] doing bit manipulation while aroused."
"bit", or actually "bite" in (vulgar) French, means penis
Lol, I didn't know that.
15:18
Amusing.
@sehe How is that green ?
urffffff - You new here?
@kbok @sehe is colorblind and he continuously jokes about it
I'm also related to pigs
@R.MartinhoFernandes Apparently...
15:20
@StackedCrooked haha.
@R.MartinhoFernandes Yeah, it's pretty funny at times.
@StackedCrooked Reeeuhm eeeuhwners can view history anyways
Ell
Ell
hi guise
@sehe But that's false.
@R.MartinhoFernandes Ismapoint... sic
@R.MartinhoFernandes The set of pigs he is related to is an empty set.
Good to know people still know the basic bear facts.
Ell
Ell
will c++ get "properties"?
@R.MartinhoFernandes Run away and climb in tree right?
15:24
@LuchianGrigore You have to be psychic in this business, didn't you know?
Clients expect fully psychic programmers to know what they want
http://stackoverflow.com/a/12533470/583833
Whats wrong with this answer?
@Ell I doubt it.
I got a downvote, trying to figure out why.
Ell
Ell
I think properties are nice
This Google recruiter asked for my CV. I gave it and now he doesn't reply back anymore.
15:25
You suck.
Apparently. It was probably so bad that the best thing was to simply not talk about it anymore.
> void ShellCode(int id,struct NE_Bin var) //функция-друг
@StackedCrooked They do that a lot
oh my, useful comments
@kbok cyrillic
15:26
What are the rules to safely put stuff in a union?
-1 it could be a global. — Luchian Grigore 2 mins ago
@EtiennedeMartel Don't? What exactly are you looking for?
Also I still don't get the green word thing.
Yeah it wasn't there when I asked.
@EtiennedeMartel Writing is always safe. Reading is only allowed from the value that you last wrote to. IIRC.
15:27
@R.MartinhoFernandes Making a poor man's variant.
Poor boy
Weep in a corner
@StackedCrooked Sounds about right
@sehe Is it some kind of poem ?
I've been wondering what kinds of type I can store in a union, in C++03.
Oh, I guess only PODs.
What's the definition of a POD in 03?
15:29
Plain old data :P
@kbok It's getting there
@EtiennedeMartel TLDR: No constructors, no private, no inheritance. Only allowed members are built-in integral types and other PODs.
@EtiennedeMartel C.
@EtiennedeMartel I believe there is a FAQ entry for that
@R.MartinhoFernandes weehoo
63
Q: What are Aggregates and PODs and how/why are they special?

Armen TsirunyanThis FAQ is about Aggregates and PODs and covers the following material: What are Aggregates? What are PODs (Plain Old Data)? How are they related? How and why are they special? What changes for C++11?

15:31
@EtiennedeMartel Also use static assert with is_pod and also static assert to check if the pod size is what you expect it to be. (AFAIK POD can still have padding.)
@StackedCrooked C++03, remember?
@EtiennedeMartel Boost provides those.
Yeah, might as well use boost::variant then.
@EtiennedeMartel I don't follow your reasoning here.
15:33
@TonyTheLion private inheritance is a part of C++ language. Maybe composition is better than this - but it is just easier to use. — PiotrNycz 26 secs ago
Boost variant is probably a better choice than a union, but I don't see how you come to that conclusion from above conversation.
he has got to be joking?
@TonyTheLion Private inheritance is composition!
How many times do I have to say that.
Ell
Ell
@TonyTheLion what is wrong with that?
@R.MartinhoFernandes 42 times
15:34
Stupid people and their stupid blindly memorized definitions instead of assimilated concepts.
Private inheritance has the potential benefit of EBO.
Ell
Ell
@R.MartinhoFernandes I sort of don't understand that - doesn't it break that liskov principapal of substitution or something?
@StackedCrooked Alright, so. I got a map to store shader parameters. It's a map<string, whatever>, and I' wondering what to use for whatever.
@R.MartinhoFernandes well, I didn't know.
@Ell No, because it can't be substituted: it's private; you can't convert to the base.
15:35
@TonyTheLion I learned that from More Effective C++ (or maybe it was Effective C++).
Ell
Ell
@R.MartinhoFernandes ooohh can't you? I never used it :L
@StackedCrooked: Me too :)
I don't agree
@Borgleader Amigo :)
@StackedCrooked I don't have that book :(
15:36
Private inheritance != composition
I wish we could downvote comments
@LuchianGrigore Looking at the final object layout I'd say that it is composition.
@TonyTheLion Now you do!
:)
@R.MartinhoFernandes Yes.
@LuchianGrigore Go ahead and explain one difference.
15:37
The syntax
ffs
@LuchianGrigore You suck :)
Man, does this __declspec(dllexport) thing sucks
this looks fine to you?
@R.MartinhoFernandes I read this answer from David Rodriguez recently about how you can use C-style casts to get around private inheritance. Never tried it myself though
Limited visibility is good.
15:38
@Prætorian Yes, you can. But then...
Makes ABI breakages less likely.
Well, C-style casts are a hammer for a reason.
@LuchianGrigore I don't see a problem.
@R.MartinhoFernandes ideone.com/St5Ix
how bout now?
@LuchianGrigore I don't see anything wrong with it. One potential issue might be that private inheritance prevents pimpl idiom.
@LuchianGrigore What would be the problem there?
15:40
It hurts my eyes!
Seriously, you can come up with real issues of private inheritance.
@LuchianGrigore Do you not realize that this is just a different notation that achieves the same as composition.
I don't care!!!
It's wrong
And it sucks
15:41
@LuchianGrigore That's an attitude that will limit your growth as a programmer.
Well, I think private inheritance is the superior form of composition, because it makes delegation simple.
Ell
Ell
can you have multiple private inheritence?
What if you need to compose from 2 classes?
Why is he whining?
@Ell Yes, max 5 bases. But you can get around that by letting the bases inherit other bases themselves.
15:42
@Borgleader Multiple inheritance?
@Ell @Borgleader works
Ell
Ell
@StackedCrooked really?
Because I currently choose not to be. Why else? — DeadMG 4 hours ago
huh
@R.MartinhoFernandes @StackedCrooked have you ever used private inheritance instead of classical composition?
15:43
Yes and thats my point, you potentially end up with the diamond inheritance tree problem
@Borgleader No, you don't.
unless you go for private virtual inheritance
@LuchianGrigore Yes.
Because it's private.
@StackedCrooked There's a limit?
15:44
There are no methods to be exposed, unless you do so explicitly. So, no diamond issues.
@R.MartinhoFernandes Does private inheritance not lead to diamond problem?
That diamond inheritance is a problem is both funny and sad.
@StackedCrooked Nope, because that only happens on public virtual methods.
You're telling me you won't have duplicates of all member variables?
@Borgleader That's not the diamond problem.
15:44
It's part of it
@Borgleader yeah, but that's not different from composition.
@Borgleader Also, if you don't want dupes, you don't want composition.
It's against nature!!!
Blasphemy!!!
Going home now. Back later.
Ok, here's a real problem with private inheritance (luckily, there are workarounds): you can't compose twice from the same base.
15:46
Here's a real problem with public inheritance, you have to share with everyone. :P
@R.MartinhoFernandes but that would be aggregation, not composition ;)
Ell
Ell
I would use private inheritence for a facade, but not if it has other members too
I would use planks for a fence.
15:48
template <typename T, int N>
struct d : public T {};

class car : private d<axis, front>, private d<axis, back> {}; // evil?
^kill it with fire
damn
Cat got in the way of my flamethrower.
I'm looking for a situation where you would want this
can't find one
15:50
It's C++. It doesn't have features because you might want them.
Of course not
I'm just saying I can't come up with a situation where I'd use this.
Ell
Ell
why doesn't someone fork c++ and fix it instead of making new languages?
Because fixing C++ is essentially making a new language.
Does anyone have something mean to say about ideone.com/Bybcd ?
Dammit, one second.
15:52
Pow.
@kbok It sucks. Now let me click that link.
What does it solve?
@kbok Looks fine. Though @LuchianGrigore may poke his eyes out upon seeing it.
:P
@CatPlusPlus Zero-initialization of a bunch of scalar members upon construction
@R.MartinhoFernandes Why ?
@CatPlusPlus You know, Visual Studio bug.
15:55
@kbok Because he doesn't like private inheritance.
@kbok Yes -- it's taking way too long to load.
@EtiennedeMartel I was going to reply something.
But then I forgot.
Just what the world needed, another string class. Thanks Microsoft. — Mark Ransom 17 secs ago
C++/CX??
WTF, another MS C++ extension, abomination.
ugh
Also... "Represents a sequential collection of Unicode characters that is used to represent text." <- data is accessible through pointers to char16.
15:58
Well, it's the way the rest of the WinAPI and .NET work, so it was kind of expected.
@kbok Unless you have some use for scalar_results other than to act as a base for results, it's polluting the global namespace without accomplishing anything. If, however, it was (for example) in the anonymous namespace in the implementation file, it wouldn't be quite so bad. Problem is that to use results elsewhere, the definition of scalar_results also has to be visible.
@TonyTheLion As I noted once previously, once you look closely you see that "extension" is really entirely the wrong word -- it has the same distinction between "reference types" and "value types" as C#, which makes it a different sort of language entirely, not just an extension.
@TonyTheLion It's essentially a COM component generator that uses a C++/CLI-like syntax.
@Ell If you keep C compatibility, you're stuck with at least a whole lot of the same problems as C++. If you don't care about C compatibility, you might as well start from an entirely different base.
The main problem is obsessing with C source compatibility.
@R.MartinhoFernandes Even C binary compatibility (unless you do some sort of automatic-wrapping) seems like a problem -- e.g., to support calling C functions that take raw pointers, you need some way to create raw pointers.
16:09
@JerryCoffin Good point. The anonymous namespace won't hurt.
@JerryCoffin The goal of this trick is to circumvent Visual Studio's refusal to correctly implement value-initialization on non-POD types.
NASA put people on the Moon. Rovio put birds into pigs. Apple put Berlin into Antarctica. Who wins?
@kbok I think it would probably have been best to state that up-front. Without the reasoning stated, it doesn't look terrible, but still seems a bit warped for no good reason.
@R.MartinhoFernandes: I noticed your comment on that question about Platform::String, that it's immutable. I'm not too familiar with C++/CX, do you know, is this documentation for String::Begin an error? It says it returns a pointer to non-const char16. How does that work, if it's immutable?
@kbok Anonymous, or a detail namespace. Something as generic as results belongs in a namespace for a non-trivial program anyway.
I'm out
buh-bye
private inheritance is not composition
16:14
@BenjaminLindley Hmm.
I'm not too familiar with it too.
That's the global function though. Not the member.
Oh. I guess I was wrong then.
But it seems there's no way to increase a string size.
Let it be known for generations to come: the robot was wrong. Once. Possibly.
4
Aw man, so much starbait in that :(
:)
16:17
This is very weird. You can mutate individual characters but not add more?
WTF Microsoft.
Anyone here buy Torchlight 2?
@JerryCoffin Yeah, sorry
@Rapptz You selling?
No I'm just wondering if people like it
I got Torchlight 1 in the latest Humble Bundle, if I like it I'll buy the second one
16:19
Torchlight 1 is pretty good.
It's just a little bit repetitive because it's just one very huge dungeon. Still a good game though.
Look mommy! Teacher told me today that we're all stars!
@R.MartinhoFernandes According to James McNellis, it is an immutable string. Strange that Begin returns a char *
2
A: How to convert Platform::String to char*?

James McNellisPlatform::String::Data() will return a wchar_t const* pointing to the contents of the string (similar to std::wstring::c_str()). Platform::String represents an immutable string, so there's no accessor to get a wchar_t*. You'll need to copy its contents, e.g. into a std::wstring, to make changes...

@Prætorian Hmm, James is the local SO expert on C++/CX, so...
Yeah, I'm gonna post a comment on that answer
16:23
I tweeted to him asking about it.
Platform::String::Data() why call it that when you could just stick to the convention of the standard library and use .c_str() ?
@JamesMcNellis If String is immutable, why does String::Begin return a char16 * and not a char16 const*? Is it legal to modify an individual character using this pointer? — Prætorian 26 secs ago
@TonyTheLion The convention of the standard library is data()!
TIL debugging with -O2 on is very... difficult.
16:24
Could be that mutating an existing string is ok, just changing its size is not
I have never heard of data()
@TonyTheLion std::string::c_str breaks the convention.
C++ Y U NO SENSIBLE?
(std::string::data is only C++11, though)
so c_str has been around longer
so that is the convention.
the other was added recently
or is string again the odd one out
that's all since C++11
can't really call that convention yet
@R.MartinhoFernandes But vector's the only one that was around before it was added to basic_string and array
C++/CX is also since C++11.
16:27
meh
@Prætorian No, not even that one.
whistles
I guess then in that context it is a convention
just one I hadn't heard of
The point is, c_str is one function in one class.
How can you call that a convention?
However there are three classes with data now.
That's a convention.
@R.MartinhoFernandes Hmm, didn't know that. Anyway, data is still more of a convention than c_str
I meant with that the thing that is normally done to get the const char * from the string
16:29
Colleague : "Hey, I copied your code, and it doesn't work". Me : "Well, lets' hope that it taught you not to copy-paste code."
bazinga :)
@TonyTheLion Think of data as a way to get to the underlying data in a sequence container, it's not string specific
@martinfernandes Looks like a documentation bug. Begin() and End() actually return wchar_t const*.
yea I can see that
oh a documentation bug
16:30
@TonyTheLion Bottom line: When they invented std::string, they thought of it in isolation, like strings were unique unto themselves. I think it's safe to say that the current view is that most of the uniqueness of string is a mistake, and it's generally better to view it as a container, not much different from other containers. My own view: it's often reasonable to use std::vector<char> instead.
@R.MartinhoFernandes Are you actually developing a Metro app or just poking around ?
@JerryCoffin right, I get it
The C compatibility can be useful though
@kbok There was a question and I looked into it.
for passing it to C API
16:32
@R.MartinhoFernandes Now you need to go post another comment :)
@JerryCoffin Exactly. C++11's std::string is just a weird vector that sticks a default-initialised element at the end.
People asking questions without posting any code on a programmers QA site, how does that even come into their minds?
@Prætorian Yeah, already did.
@TonyTheLion It doesn't.
@sehe MWahahha, I was right. Phew.
16:34
@R.MartinhoFernandes Close, but one other detail: std::string is really only intended to be instantiated over types that are exception free -- e.g., assigning them can never throw. std::vector is designed to be sane in the face of exceptions where std::string assumes they can't happen.
16:40
This was disturbing.
I think we can all use this :)
@TonyTheLion omg that’s awesome.
However, I would write an app for that and it would be free. :)
> No guarantees are made that we'll be able to get you out of a tricky situation.
16:47
@Prætorian: The documentation is wrong. Begin() and End() both return char16 const*. You can see their definitions in <vccorlib.h>. You may not modify the pointed-to characters (strings are reference counted, and if there are other owners and you modify the string, those other owners will be very surprised to discover that their string has changed). I'll see what I can do to get the documentation fixed. Thanks for the heads-up. — James McNellis 4 mins ago
How hard will it be to make a suduko game in a console application :D
@MohamedAhmedNabil Probably not at all
Work on Tic Tac Toe first?
@Rapptz Did it, Easy stuff
16:52
We have Tic Tac Toe as a homework assignment, multiplayer in JavaScript. I understand that as over-the-network multiplayer.
@TonyTheLion One flaw. "... sexiest thing a woman.."
That was the joke Drise. Hence the shrug
Xeo
Xeo
0
Q: is "const arguments and non-cost return statement " possible?

user1308990Is the below function definition is legal T& GetMax(const T& t1, const T& t2) { .... } It is written that : "At the return statements, compiler would complain that t1 or t2 cannot be converted to non-const." Does it mean that it is illegal ,if not what else? Could you provide exa...

the fuck.
so any fun in here?
16:57
"non-cost return statement" nothing is free in this world.
lol
Colleague : "Hey, I copied your code, and it doesn't work". Me : "Fine, doesn't work for me either, call back when you've debugged it"
5

« first day (706 days earlier)      last day (4467 days later) »