« first day (1175 days earlier)      last day (3999 days later) » 

18:00
0
Q: How do I make a compiler in my Native Language? Like "Chinese C++"

Aritra ChakrabortyIn this question : Coding Java in non english language, for eg Spanish or Japanese there is no definite solution. I want to make a C compiler in Bengali(Indian language). But I don't know where to start. I started to study this article: Let's Build a Compiler but I don't know if I'm going the ri...

@StackedCrooked Is that you? ^^ :D:D
Ell
Ell
I hope I never have to go to texas
@Mysticial Must be a doppelganger.
Xeo
Xeo
A Heavy Storm appears!
Heavy Storm casts Hail. It's super effective!
user1804599
TIL: std::plus<> and friends.
user1804599
I always added the types explicitly. :V
Xeo
Xeo
18:05
C++14
@rightfold Is that like using jQuery to add a number to another number?
@rightfold I don't think so (at least currently). Those only come into use with a garbage collector, which (TTBOMK) nobody currently supplies.
@Mysticial those were necessary/handy pre-lambda
They're just structs with operators.
user3010322
@Xeo There was a MASSIVE blizzard over here too!
Xeo
Xeo
@rubenvb They're still handy, especially the <> versions
user1804599
18:07
% cat main.cpp
#include <functional>

int main() { return std::plus<>()(-1, 1); }
% clang++ main.cpp -std=c++1y -I ~/libcxx/include -Wall -Wextra -Werror -pedantic && ./a.out && echo $?
0
@Mysticial Not really. It can make sense when you want to do addition in an algorithm. Even with lambdas, something like std::plus can be simpler.
user1804599
@Xeo :3
user3010322
IIRC STL is the one who proposed those
user3010322
ANd he implemented them early for VS 2013 RTM
user1804599
@rubenvb Screw writing [] (auto a, auto b) { return a + b; } as opposed to std::plus<>().
18:08
@ThePhD He proposed and implemented a modification. std::plus and such have been around since the 1998 standard.
user1804599
Also, the former is duplication.
Right, because -1 + 1 is a lot less clear than std::plus(-1,1). wtf.
user3010322
@Jefffrey @MartinJames @Xeo @melak47 @Rapptz How goes your snake implementation?
user1804599
It has already been implemented for you.
user3010322
@JerryCoffin I know, I know.
Xeo
Xeo
18:08
@ThePhD I haven't even thought about doing anything code-related in the last two weeks
user1804599
@rubenvb Yeah this is also the only use case of std::plus.
Xeo
Xeo
@rightfold that also makes copies
user1804599
Because you can totally not pass it to HOFs no no.
user3010322
@rightfold Haha, cleansing your system? :P
user1804599
@Xeo See? Error-prone!
18:09
woohoo I received my rasperry pi :3
user3010322
@Borgleader Parrrrrtay!
user3010322
Now it's time to build that Ray Tracer.
user3010322
Since that's priority #1.
user3010322
@Borgleader Kinky.
user1804599
18:17
Okido.
user1804599
What shall I do this weekend?
user3010322
Akimbo.
user1804599
 O
< >
14 mins ago, by Xeo
@ThePhD I haven't even thought about doing anything code-related in the last two weeks
But I've laid down an MVC design for it
It's on my blackboard right now
@rubenvb The usual use would be something like: std::transform(x.begin(), x.end(), x.begin(), std::bind1st(std::plus<int>(), 7)); to add 7 to every item in x.
18:24
Also exams
@ThePhD, what about yours?
@JerryCoffin or for(auto&& thing : x) thing+=7;
user3010322
It doesn't exist :D
@ThePhD yeaaah :D
Seriously. I doubt the usefulness of more construed template metastructs.
@rubenvb Doesn’t do the same thing.
user3010322
18:28
@Jefffrey What? The repo isn't doing anything~
It's doing Hissss~
~_~
Or I should say, it’s not parametrized the same. The algo version can change the destination.
@LucDanton OK, sure, but that isn't a problem in my case either.
You’ll run off the end.
for(auto&& thing : x) y.push_back(item+7);
18:32
Haha, the iterator version sucks just as much!
@LucDanton what are you on about? I can't see the "run off the end"...
Single iterator without end.
@rubenvb you are making me think too much
@Jefffrey I have that effect on people.
@LucDanton You're still not making much sense.
What is for (auto&& ..) supposed to accomplish ?
Doesn't make much sense to me
lol, I know what a range for is, I dunno what an iteration over r-values is supposed to mean :/
@Jefffrey it's a universal reference thingie.
oh, I thought that only worked with function arguments
I better look that up. Oh hey, look! That's convenient.
@rubenvb You'd want for (auto &thing : x) thing += 7;
@JerryCoffin it works in this case at least: coliru.stacked-crooked.com/a/6f73549abfe504c7
Not sure of the limitations.
That's what you guys are for.
18:40
@rubenvb As long as it's int, it'll probably be fine (moving from an int is unlikely to affect the original). For anything where the rvalue reference resulted in a real move, you'd probably end up with UB. In any case, an rvalue reference is the wrong thing to use here -- you want an lvalue reference.
@JerryCoffin Although the text itself recommends against it, the example here does show the merit of auto&&: stackoverflow.com/a/13130795/256138
Also, take it up with @Xeo
(hiding behind the big guns here)
I'm not sure it's UB, it seems more like undesirable - but it does mean that to reset an object (auto&& clean : x); will do the job -- btw - since {} on int results in 0, shouldn't a "moved" int be reset as well, or odes a moved act the same as uninitialized int - in which case the present value is as good as any other, but I don't think its defined to stay as is
I don't think there are any moves here.
@rubenvb Jerry seemed to think there were, so if he's right...
user1804599
@GlennTeitelbaum moved-from integers are not affected.
18:46
@rightfold That is defined for all POD?
user1804599
Moving an integer is equivalent to copying it.
user1804599
It is the same for floating-point numbers, pointers and Booleans.
@rightfold, anything without a move constructor will just copy, or just PODs
user1804599
If you have no move constructor but you do have a copy constructor, it will always copy.
And if you have neither it will byte copy
18:50
auto can potentially become both int and int& right?
user1804599
@GlennTeitelbaum If you have neither, you can’t copy.
while auto& can only become int&, correct?
user1804599
Cannot copy without a copy constructor. :v
user1804599
(For custom types.)
user1804599
@Jefffrey Only int.
18:51
oh, ok
auto always becomes T
if you need different "rule - set", do decltype
@rightfold struct x { int y; } will copy
user1804599
Indeed; x has a copy constructor.
Why does HTML5 YT player have "speed" option
Who'd want to watch videos at 2x speed
idgi
user1804599
@GlennTeitelbaum Note that C++ generates boilerplate for you. It isn’t Java.
18:54
@CatPlusPlus A friend of mine was reviewing films for some art class at 2 or 3x speed
you get through them a lot faster and you can understand what's going on
That is awfully specific function
@rightfold Stop that, I meant explicit
Now, I tried to get a reduced example with a move constructor (but it's never called, due to the copy constructor probably which is required for std::plus): coliru.stacked-crooked.com/a/dc08611d1007a3c2
I watch some series at 1.4
@CatPlusPlus I cannot watch "Shining" without at least a x4 speed
user1804599
18:55
@GlennTeitelbaum I do not get it.
user1804599
Do you mean struct S { S(S const&) = default };?
Also, this shows the range-based for way is superior: it has less requirements on what you're operating on.
I'm not vouching for the correctness of my operators. I almost never need them, so I almost never write them.
superior to what
The std::plus thing.
because to add, std::plus needs a lot more functions.
@rightfold 1) The it's not java comment is odd from somebody who possibly wasn't even born when I started coding C++ 2) I meant - if you do not explicitely write one, you will get a default byte copy
18:59
@GlennTeitelbaum So 1 is just "Appeal to authority- I'm older than you"?
user1804599
If you don’t write a copy constructor, one will be generated that does a memberwise copy. The data types of the members are pretty much irrelevant; they just have to be copyable.
@DeadMG damn, now I need to un-ignore him to read that message you replied to :)
@DeadMG 1 is respect your elders, not an authpority play
@rightfold the example I wrote is the bare minimum that would compile. I got implicitly deleted functions otherwise.
Might be due to the move constructor.
@GlennTeitelbaum "Respect your elders" is an authority play.
user1804599
19:02
(Assuming you didn’t declare a move constructor explicitly.)
@DeadMG No, it means don't be rude, it doesn't mean believe them
being rude or not has absolutely nothing whatsoever to do with the ages of the people involved.
Note I also did bad things in the move constructor.
there's no more or less reason to be rude to an older person than a younger.
Which do not seem to be executed.
19:02
@DeadMG Well said.
aaand back to ignore :)
@ScarletAmaranth Arg - I didn't get a chance to say hello
user1804599
@ScarletAmaranth He didn’t even get a chance to say hello.
Ell
Ell
19:03
@DeadMG Id say that there is usually no reason to be rude ever, but older people do have more experience on this earth (of course not necessarily programming or something specific)
and it's also noteworthy that it is very difficult to learn from other people's mistakes
(imho)
user1804599
Ell.
user1804599
I’m just wondering.
if they have experience.. then they can justify their opinions with perfectly rational arguments.
user1804599
What do you do each day?
that do not sum up as "Bitch I've got more experience".
unless operating under a time constraint, there's no logical reason to trust their word any more than anyone else's
user1804599
19:05
You can trust my word.
For I have a beard.
does decltype return static type of an inherited type? (I suppose it does which brings me to the following question) -> what type does it return for a type that's inherited from multiple classes?
user1804599
decltype always yields the static type of an expression. (It is the only option, because it won’t evaluate the fucking expression.)
@rightfold are you the mediator between the plonk world and the live world?
look at the second part of the question @rightfold
@DeadMG I'm not sure I'd go quite that far. I would say "I've got more experience" shouldn't be taken as outweighing more direct arguments, but if everything else is equal, more (applicable) experience might qualify as (barely) enough to break an otherwise perfect tie.
19:07
reminds me of "Ghost"
@ScarletAmaranth: decltype() returns the type of the argument as it is declared. Only the static type is known, i.e., it can't return the dynamic type.
@DeadMG It was about the "It's not Java" staement which does make no sense to somebody with years of C++, and yes, people with more experience have earned some degree of respect, not that you can be rude to the young, but an extra level of respect should be expected
user3010322
Hrrm.
user1804599
@ScarletAmaranth Inheritance is irrelevant.
Hello! (in case it is considered rude to join without greetings...)
19:08
@GlennTeitelbaum why
user1804599
struct A {}; struct B {}; struct C : A, B {};
decltype(A()); // A
decltype(B()); // B
decltype(C()); // C
@GlennTeitelbaum No, it really shouldn't.
I cannot give respect a priori, you'll have to tell me why
@DietmarKühl Greetings
it's usually the people with more C++ experience that are more problematic.
19:09
Also, nobody has age on the internet
they are the ones who haven't refreshed their understanding of the language since 1993.
@DietmarKühl Hi Dietmar. Rude would be saying something nice about Java or PHP. Joining without a greeting or calling somebody an idiot--those are perfectly fine. :-)
user1804599
@GlennTeitelbaum I’m not sure how you interpreted “it’s not Java” statement.
ah, right, I can't do T and U* myPtr;
brainfart, disregard the question :)
@DeadMG lol, if he tried calling me on something that wasn't around in 1993, youd have a point
19:10
at least when someone says "I have two weeks experience in C++", you know they suck.
but when they say "I've got 25 years experience in C++", it doesn't really tell you anything.
@DeadMG: that isn't true for everybody, though. I'm programming C++ since nearly a quarter of century.
user1804599
Because FYI, it was a joke referring to writing boilerplate.
admittedly, I'm not entirely up to date with C++14, yet, though.
@DietmarKühl Yes, it was a complete generalization. Obviously there are plenty of people who have been C++ing for a long time and have a quite sufficient handle on it.
and there are plenty of new people who are taught C with Classes.
user3010322
I have a sufficient handle on it~
user1804599
19:11
@DietmarKühl Me only since a quarter of a decade! :D
@ThePhD dude, you're a terrible programmer.
7
user3010322
Wait, you mean rightfold, right? :D
don't worry
everybody here is a terrible programmer :)
user1804599
@DeadMG Dankjewel. :)
user3010322
@Jefffrey Not me!
user3010322
19:11
I'm amazing~
user3010322
@rightfold Works for me~
I'm still learning C++, though, despite dealing with it on a nearly daily basis for the ~20 years...
user3010322
@DeadMG Nooo change it back. D:
user1804599
@DietmarKühl C++ is ever-evolving.
user3010322
19:12
You cannot master the C++.
@rightfold go back to Ruby :P
user3010322
The C++ will master you.
user3010322
3 days until interview with Ludia.
By the time you understand why you should repect the older generation, you are part of it
user1804599
@ScarletAmaranth Meh; dynamic typing.
19:13
lolno
user1804599
I’d rather implement Ruby in C++ than write Ruby.
@GlennTeitelbaum as far as I know you could be 6
@DeadMG My own experience is that the problematic ones are in the middle ground. Those who've done C++ since (say) the 1980's have had to change their game at least a few times to keep up at all. The problems are those who've done it just long enough that what they know is obsolete, but haven't been around quite long enough that they've been absolutely forced to update their skills. The worst are probably those who've been on the same project forever.
user1804599
Wait.
@ThePhD Oh nooo, better brush up on what that strange O() notation means!
user1804599
19:13
Why is respect being discussed?
because you don't have respect
user3010322
@ScarletAmaranth It's a meaningless piece of crap for a useless math paper.
user3010322
That's what it means. D:<
@Jefffrey if I were, you'd owe me alot more respect :)
user1804599
I haven’t written any disrespecting message today. vOv
19:14
@GlennTeitelbaum I love how you do reasoning
@rightfold Glenn said "respect your elders".
user3010322
Only respect your elders if they have long white bears and can do flying kicks.
user1804599
@DeadMG Yeah, but why?
I dunno
@Jefffrey A 6 yo with the wisdom of an old man is due respect
19:16
ask him why he said it.
user1804599
@GlennTeitelbaum Why did you say it?
@rightfold For the usual reason: somebody thinks he's earned more than he's being given, but can't cite much rational support for the claim, so he's citing age instead. As (I believe) the oldest guy present, I want it noted that while I appreciate respect, I'd rather receive it because of what I've said, done, etc., not just because I'm an old fart.
user1804599
Are you saying you’re an old fart?
yes, he's an old fart
user1804599
Do they smell better than new farts?
19:17
@rightfold Yeah, pretty much.
@rightfold At the moment, probably better than most of the new farts present, but only because of the time zone I live in, so I took my shower a bit more recently. :-)
@JerryCoffin You are lying and you know it, they smell much worse
user1804599
What if the fart is from a Dutch oven?
@rightfold I have little enough experience that I can't really comment meaningfully on that.
@JerryCoffin I was not claiming as much about respect, as lack of disrespect, it is something that has been slowly dying in our society. For example, I notice if an elderly person needs a seat on mass transit it is usually somebody 50ish as opposed to 20ish that will get up
@GlennTeitelbaum What, young people don't deserve seats anymore?
19:22
lol
btw - while the discussion is fun - it all started because I felt rightfold's comment implied I was just learning C++ and coming from Java, so i thought my years of experience were relevent
@DeadMG Not if it means an elderly person has to stand
what, they don't have legs anymore?
@GlennTeitelbaum I'll have to take your word for it. I can't say I recall seeing many elderly people using mass transit while I've been in Europe, and here at home about the only mass transit available is on airlines where seats are reserved.
Maybe its more a East coast thing then, but I will ask, who would give up a seat so that an elderly person could sit, I have.
you haven't justified why anybody should
19:24
@DeadMG I'll take that as a no
Xeo
Xeo
@rubenvb Whut?
that stuff is from the same old "Women are objects to cook and clean" line of traditional bullshit.
@Xeo I was hiding behind your quotes. They may or may not be misrepresented in light of the discussion.
@GlennTeitelbaum Mass transit is more an east coast thing (or, more accurately, a higher population density thing). That said, I suppose it would depend on circumstances. For example, if I'd just come off a really long flight there's a pretty good change I wouldn't be paying enough attention to my surroundings to even notice that somebody older might need a seat.
Xeo
Xeo
What discussion? (too lazy to read through the transcript)
@JerryCoffin Not that there's a chance for anybody older than you to actually be on that transit
19:28
@DeadMG I am not about to teach you why you should respect your elders, it is something your parents should have done, and if they haven't then they will likely be rewarded appropriately
@Xeo Basically, I use for(auto&& item : container) item = ...; and they were going on about how rvalue refs and moves might ruin the code.
Xeo
Xeo
What moves?
@GlennTeitelbaum So basically, there's no rational reason for it.
@Xeo That was what I thought. So I started gathering quotes by smarter people to say auto&& is the way it should be done.
19:30
@Xeo I run into Pangaeans every once in a while. :-)
user1804599
@DeadMG depends on the culture.
in fact, considering the current economic and social climates, I expect the average respect for the elderly to be going down rather rapidly.
user1804599
In the Netherlands it is common practice to unseat yourself if you’re young and a very old, pregnant, handicapped etc person has to stand otherwise.
Xeo
Xeo
@rubenvb I guess it goes into @Lightness' direction of thought: If the range changes to produce rvalues. you won't notice with auto&&, while you would with auto&.
user1804599
(Unless you’re scum.)
Xeo
Xeo
19:31
Murphy etc
@rightfold Can you explain that to DeadMG?
@Xeo when would that happen though?
wait, so T&& in template<class T> func(T&&) is an universal reference, right?
user1804599
Where “very old” is like, 70+.
Because my construed example I tried to code up turned up the right result.
19:31
because there's type deduction
Xeo
Xeo
@rubenvb Whereever. Some non-generic code that uses auto&& for convenience and relies on the range being modified, and somebody else changes the range
who knows
user1804599
@Jefffrey Yes, assuming the caller doesn’t add explicit template arguments.
@rightfold I thought very old was 49?
@rightfold you mean like func<int>(1)?
Xeo
Xeo
(I specifically qualified my comment with "in generic code")
user1804599
19:32
@Jefffrey Yeah.
user1804599
@GlennTeitelbaum That’s pretty young in my country.
@LightnessRacesinOrbit The default is more or less the opposite. You only replace std::endl with '\n' when you explicitly know that you don't want to flush. — James Kanze 2 hours ago
what
Xeo
Xeo
@Jefffrey It's an rvalue reference. :P
@rightfold in that case T&& is not an universal reference, correct?
Xeo
Xeo
(If you don't want to be confused, don't listen to me and keep believing in the lie.)
19:33
@Xeo yeah, I did notice that. Still, the "generic code" should accomodate everything, right?
user1804599
Most people born these days have a life expectancy of more than a hundred years.
user1804599
@Jefffrey Yes.
ok, got it, thanks
user1804599
In that case it is an rvalue reference. :v
Xeo
Xeo
It's always an rvalue ref
19:33
also,,,look at this please Sir
-6
Q: I am joining 2 tables and want to fetch my friends phone numbers in my profile

user3158294I am joining 2 tables and getting the below result. My question is: in Vasanth Gowda profile, I should get my friend's phone number that is Sudarshan and Priyanka, and in their profile they should get my number. Can anyone help me regarding this? name phone friendname Vasan...

user1804599
@LightnessRacesinOrbit LOL
@Xeo I'll know the truth at the end of Scott's video, he says
:)
Xeo
Xeo
hehe
user1804599
@Xeo Oops, duh.
user1804599
But at least I didn’t lie. :)
Xeo
Xeo
19:34
Template argument deduction is where the magic happens
reference collapsing is intuitive, I dunno why scott is making such a fuss about it
user1804599
Pisstime!
@LightnessRacesinOrbit Ok, just wow
Xeo
Xeo
@ScarletAmaranth Maybe it is for you
user1804599
Ugh.
Xeo
Xeo
19:39
@rubenvb It always depends, I guess. If you absolutely, positively want to make sure the range is modified (i.e., the change to the item is reflected in the origin of the range), use auto&. If you just want to be able to modify the item, but don't care if it propagates back, use auto&&. If you don't want to modify the item, use auto const&.
user1804599
Why do people who have six children get even more of them while they are barely able to take care of the six they already have. :|
Xeo
Xeo
auto&& is also for other cases in generic code (moving things out of the range, for example)
@rightfold :: because religion :: (see how valid of an argument?)
user1804599
Ban religion; it makes children starve.
-7
Q: I'm not looking for someone to do my work for me

user3157902help me in c++, I need your help how to have a product of matrix[4][4] and vector[4] with 2 functions(1.prodhimi , 2.printo), and the product to be shown as martix.

and that's it!
19:46
hey, using jsoncpp, how to skip first element using new c++11 for iteration?
@LightnessRacesinOrbit lol
I should file a bug to ask Boost.Spirit people to make their code constexpr usable.
@rightfold It really has very little to do with religion (in most cases, anyway). Simpler answer is that sex is one thing you can enjoy even if you're almost starving. Birth control generally costs at least a little, so the poorer you are, the less likely you are to use it. As long as you don't mind ruining their lives, teenagers can be not only self-sustaining, but can contribute positively to the family's income.
@RokKralj ++
@RokKralj The same way you skipped the first element in C++03.
19:46
@Xeo Right, I'll remember that.
user1804599
@RokKralj Write an adaptor tailing<T> that returns T::cbegin() + 1 from cbegin() and write a factory function tail(T const&) that returns a tailing<T>.
@rightfold Because "the state will take care of me and my family"
as if "the state" is some magical entity that doesn't consist of everybody in it
@LightnessRacesinOrbit is that why people like global state? :)
@melak47 yes!
Globals are a great analogy to globalism, actually
user1804599
Globals aren’t global.
user1804599
19:48
They’re process-local.
In this analogy, the process is the planet Earth. You haven't read The Hitchhiker's Guide, I take it
in One Piece there's a global state
user1804599
@LightnessRacesinOrbit I get nervous and cramped from reading fiction.
user1804599
I don’t know why.
user1804599
It makes me sweat a lot.
user1804599
19:51
The same happens when I do not listen to music.
user1804599
I think I am addicted to not reading fiction and to listening to music.
user1804599
@StackedCrooked The state consists of only one piece!
:)
It's the pirates who are after the one piece.
user1804599
Vandaag heb ik geleerd dat die gekke Belgen ook nog eens tussenvoegsels met hoofdletters schrijven!
Cultuurbarbaren!
user1804599
Do you sort Henk de Vries under D or V? How about Henk De Vries?
19:54
@rightfold That depends on the name itself. There can be "Van Dijk" and "van Dijk" as different names.
user1804599
My god.
user1804599
It is worse than I thought.
I wanted to do my daily rep whoring but the questions being asked on the C++ tag are just too pathetic.
@DietmarKühl welcome to SO : - /
@rightfold Well there's a pretty good movie adaptation, too.
user1804599
19:57
My hair is so static.

« first day (1175 days earlier)      last day (3999 days later) »