« first day (1988 days earlier)      last day (2962 days later) » 
00:00 - 17:0017:00 - 00:00

12:07 AM
Any interesting c++ articles?
This post kinda scares me :-/
 
@Mikhail That is why I never go to reddit.
It is weird.
 
Yeah, race conditions are a purely quantum phenomena - they are only real when you measure them.
 
12:29 AM
!!!!
 
12:51 AM
I literally cannot make a variadic list out of this.
I think I'm going to scream.
 
(*wait until you realize your compiler doesn't support variadic lists")
 
Xeo
1:56 AM
Hm. 4-day weekend, day 1 of 4: Got nothing done, slept 80% of the day.
 
@Xeo high-five me too
 
Xeo
Also still a bit salty somebody is already making "my" game. Graaah.
Time for some more sleep
 
lol, night
 
2:33 AM
night
 
3:08 AM
It's sapphire
 
Hi. Can anyone here please answer this question, its been bothering me all day. stackoverflow.com/questions/36231206/…
 
Hey does anyone know why
no new questions are appearing
for me there hasnt been a new question in 11 mins
since i last checked
 
3:47 AM
@TrevorClarke Are you filtering them by only a few obscure tags? That could be why
 
no
i think it was lagging or something
 
btw, is it wrong to abuse if-else/switch statements in a function that needs to map 100+ numbers to different functions? I'm about to write an interpreter. No problem for me with a switch, but might there be a more legible way?
 
@Aaron3468 Why not use a map?
 
@StackedCrooked Quite a quirky song ^^; not that it's unexpected from mackelmore
 
3:56 AM
if (else) might be good when you can prioritize the use cases?
 
@Aaron3468 Too bad I posted the censored version. Didn't realize until it was too late.
 
Are there any shows like CppCast?
 
@Mikhail Fair point, I'd be best off if I used an if/else if some commands are used disproportionately often. Map would probably execute faster on average if the functions were all called equally often
 
@Mikhail There's SE radio.
 
Fuck, so people are bitching about concepts not being used. Have any of you guys actually used concepts? I have no plans to use them. Is it just some academic bullshit?
 
4:03 AM
@Mikhail It's a crucial missing part of the language.
Although Alexandrescu claims that static if is what C++ needs.
 
@Mikhail They look very useful, but 90% of the time they're redundant. It's like they're trying to make C++ a higher level programming language in the same hamstringed way microsoft tried to make windows 7 easier by abstracting it in win 10.
 
i would really like static_if, but that feels unrelated. The most important thing I want are more things I can tag functions with, for example a pure or force_devirtualization. I can't imagine using concepts anywhere...
Maybe CGAL might benefit with more usable messages, but fuck it. I can't find a usecase in my code. Have you guys ever used it?
 
You can't force devirtualization.
 
@StackedCrooked I want the compiler to choke
 
If you want to force it then just use static_cast.
 
4:08 AM
I'm not aware of that technique...
 
Cast it to its derived type.
 
So, anyways what are the success stories of people using concepts?
( that don't directly come from those guys at Texas)
 
They are too busy celebrating.
 
Well they didn't get into the latest ISO ;-)
 
The largest benefit is that it's an attempt to circumvent the typing and generic systems entirely. The biggest downside is that it circumvents the familiar typing and generic systems. Quite literally, it is a different typing system entirely, as far as I can tell. Unnecessary, but can be useful.
 
4:14 AM
I want use cases
 
I don't see how it circumvents anything.
 
@StackedCrooked Poor choice of word. It abstracts.
 
Oh, wait. Maybe it does have problems like leading to dead code.
 
What should I cook today?
 
The downside is that now you can use three different levels of abstraction in one language. When I first learned to use generics, it felt like a completely new programming language because I didn't need int or casting anymore when I could simply allow operations on a generic type that implemented them.
 
4:19 AM
Well, the complexity isn't greater than if somebody introduced interfaces. The real problem is that Java makes interfaces easy, because they look just like base classes. In C++ we shot ourselves in the foot with needless complexity.
 
Pretty much. C++ code is basically an amalgamation of any programming paradigm you want; macros literally let you turn C++ syntax into other language syntax, and generics introduce feasible functional programming. Every codebase basically uses a different dialect of C++.
 
So, the way we fix this is to move stuff closer to Java's style. (Java is dead, so we can take their turf)
Also a good example of what you brought up is the Boost::spirit stuff
 
@Mikhail I think Java being limited to OOP only made codebases more legible to 'Java programmers', but it also means the language has very obtuse ways to implement other language's features (global variables in Singleton classes that intentionally kill other copies)
C++ is a huge toolshed that lets you choose what you need. Some C++ developers decide that a lawnmower can be made to paint a house and everybody else is left scratching their head at the brilliance(?)
So, being the accident-prone idiot that I am, I tend to use a hammer or screwdriver when I code C++, instead of a commanche helicopter. Most languages don't even have a commanche helicopter
</monologue>
 
5:08 AM
Is this undefined behavior that just happens to "work"? Am I misunderstanding about the lifetimes here? coliru.stacked-crooked.com/a/39e1946e508ada42
Because what I expect in that code is segfaults.
 
@caps I didn't go through all of it carefully, but at first glance it looks like it probably has defined behavior. String literals have static storage duration, so they exist even when the scope where they're used has been exited.
 
@JerryCoffin Whoa.
So to test what I want to test, I need to dynamically allocate the char*s?
Because that only applies to string literals known at compile-time, right?
 
@caps I dunno. What do you want to test?
 
@JerryCoffin I'm trying to understand how RapidJSON relates to the lifetimes of the char*s that it parses, to figure out under what conditions it's safe to store the return value of GetString() in a string_view.
I have a test (that uses a string literal) and seems to indicate that it's safe, but then i did that test to see what happens with string_view and char* in the general case.
So my tests so far are garbage.
 
@caps Yes, if you dynamically allocate, then trying to use a string_view after the storage has been released will give UB (but that mostly means testing won't prove much, regardless of the results). Well, you might get a visible failure, but even if it appears to work, that doesn't mean it's good.
 
5:19 AM
@JerryCoffin Right, because the memory location might still hold the old data. :-/
Still not what I expect.
gcc gives me much more like what I expect there.
So I think this is undefined behavior.
I'm not really sure how to tell what RapidJSON is doing.
I guess I could build a RapidJSON object using their little API, store the resultant JSON as a string, build a RapidJSON object from that string and experiment with those lifetimes.
It seems like rapidjson::Document::Parse(char*) won't necessarily take ownership of the char*.
 
wait why would something take ownership of the raw pointer it takes as an argument
or does rapidjson predate smart pointers?
 
@jaggedSpire It wouldn't, but it might make a copy (a la std::string)
> RapidJSON provide two strategies for storing string.
> copy-string: allocates a buffer, and then copy the source data into it.
> const-string: simply store a pointer of string.
> Copy-string is always safe because it owns a copy of the data. Const-string can be used for storing string literal, and in-situ parsing which we will mentioned in Document section.
> To make memory allocation customizable, RapidJSON requires user to pass an instance of allocator, whenever an operation may require allocation. This design is needed to prevent storing a allocator (or Document) pointer per Value.
Documentation FTW.
 
ah
considering its focus on speed I can see the reasoning for that.
 
My logic is that if I have a char* with a safe lifetime then I should not copy the contents of that char*. So if I want to store sub-parts of the JSON I can use a string_view to store them.
 
you're aware temporaries are deconstructed at the end of the lifetime of the full-expression where they're constructed, right?
 
5:28 AM
@jaggedSpire Yes.
That is why some of the behavior I was getting with my "tests" was surprising me.
 
this seems to be a very common problem with strings
 
solution: no more strings
 
So, basically, my class will take ownership of the char* (probably by taking a std::string), and will keep it alive. Then I will have vectors of string_views into parts of the JSON that I got from rapidjson::Document::GetString().
 
or just pass an std::string as a reference?
 
5:44 AM
Ugg, god more optimization from people whose challenges don't look like mine.
 
5:57 AM
@Mikhail In my case, the string being passed as a reference would have a shorter lifetime than my objects.
 
Sometimes syntactic sugar is nice. Python is a very sweet language in this sense, but doesn't have a switch statement. I need to implement conditional logic, so I can't just use a dictionary. Now I have to type elif opcode == ... : just over 500 times.
 
you can own an object, but you can't own a pointer...
the real moral is to never, never use c strings
 
doesn't python have lambdas
 
yes...
 
getattr(self, 'opcode_{}'.format(opcode))(), there, switch
 
6:04 AM
@jaggedSpire I suppose I could. I'll be using a lot of anonymous functions then like lambda x: ldRegisterWith('A', x)
@CatPlusPlus very clever! I can write a function that maps to 5 or 6 different opcodes if I can pass specific arguments to existing functions depending on the opcode. Your code is probably overkill and limits reusability of functions. What I'm doing was an edge-case where if/else seemed like the only good implementation, but a lambda dictionary comes very close
Correction, lambda functions are basically the same as writing individual functions and using that really clever code to switch. So either way, they're both a bit better than the if/else.
 
6:27 AM
template <typename T>
void abc(T&& a) // forwarding reference
{ }

template <typename T>
void abc(const T&& a) // as soon as i add const it's no longer a forwarding reference right?
{ }
i cant remember :<
 
@Phantom indeed
 
@LucDanton Thanks.
 
6:44 AM
@VeronikaPrüssels rip gw2 hot
 
7:03 AM
feels so weird to write code like void operator() (const std::remove_reference_t<Args>&... arg)
 
thats some weird code, what does it do?
so remove_reference lets you compare underlying types?
 
@Mikhail prevent deduction, likely
 
sec let me upload it to ideone
 
@Mikhail the traditional example is std::forward
you can’t call it as e.g. std::forward(0) // can't deduce template argument
 
This is what i was trying to do
its part of some weird class which takes a function, converts it to a functor, and the functor changes the arg types to const arg&
 
7:10 AM
In the future you'd get to use C style casts
and pointers
 
at first i thought that having const args&... would work with the rvalue 5
 
@Phantom note: if you have A = int&, then A const is int&
 
yeah took me a bit to figure that out...
 
user1804599
7:50 AM
@jaggedSpire yes, but their bodies can only be single expressions (lol)
 
user1804599
Significant indentation IN YO FACE
 
Ven
8:07 AM
Yo
 
user1804599
Ohne dick kann ich nicht sein.
 
8:25 AM
Bah, stupid users.
log4cplus, a C++ library, advertises nowhere that it is .NET compatible, yet, I get a single star review on SourceForge that it does not work with .NET.
 
8:43 AM
I have a Chrome plugin that will insert anime ratings from myanimelist into Wikipedia anime pages.
I got a one-star rating from somebody who complained it only worked on English pages.
@wilx Kinda similar, not?
Actually, no. I could easily make it work for non-English Wikipedia pages.
But I don't care because he gave me a shitty 1-star rating.
Never forget.
@Zoidberg Dick Tracy.
 
9:10 AM
Is SF still blocked in firefox?
 
9:32 AM
Firefox blocks Science Fiction? WTF!
 
TIL @StackedCrooked good at holding grudges
 
Still need to watch BDGAIM.
Probably gonna watch GATE first.
^ Concorde's first visit to Heathrow Airport on 1 July 1972
Cool stuff :)
 
Xeo
@StackedCrooked "Erased"
 
Watching it right now :)
 
Xeo
9:47 AM
Still need to watch the last 2 or 3 episodes, since I'm only watching them together with my buddy.
 
10:06 AM
@Xeo Ok.
So I shall refrain from discussing the ending with @ScarletAmaranth.
PS: EVERYONE DIES! MUAHAH
 
well
the ending is...
ok
I would channel @wilx to roll a "decent but meh"
 
I don't think it's ok.
(I'm restoring the balance for @Xeo.)
 
@ScarletAmaranth :D
 
@Xeo Dude don't take too long. We need to discuss the ending.
 
10:08 AM
ahahah
indeed
what is this stupid 3 sec between messages chat restriction for fuck sakes
 
10:26 AM
Morning. More or less :D
 
Xeo
@StackedCrooked I'm watching them this evening
 
Cool :)
@ArneMertz Btw, I liked the cppcast episode.
At my workplace I have a colleague who's very confident about his code and about his "seniority". And his code is total crap.
 
Thanks :) Was a bit of a surprise they invited me...
 
It's hard to step up to that.
@ArneMertz :)
@ArneMertz Your blog probably gets a lot of readers.
 
10:32 AM
Yeah I knew some people like that. Then cane the day when I was fed up with that crap and told them they had been out of the loop for decades and were writing dinosaur code.
@StackedCrooked sometimes more, sometimes less. A few hundred a day normally
 
@ArneMertz I haven't been so straightforward yet, but it might happen soon. I should probably refrain though. It seems most of my colleagues seem have "joined my side" even though I'm not waging a political war or anything. Just trying to do a good job.
I feel bad for them since they assumed for many years that (bad) code was supposed to be like this.
 
@StackedCrooked a few people doing a bad job can destroy much good work, sadly
 
I know all too well.
 
Anyways, getting off the bus now. Have a nice easter weekend!
 
Thanks.
Good episode this week.
 
10:46 AM
does anyone here have any experience with hard drive?
is it true that docking station can not copy a disk that has been indicated by a mother board that 'hard disk failure imminent'
 
That's one way to code review
 
Xeo
Hmmm... TIL: My rice cooker isn't quite good enough to make Japanese-style rice cooker pancakes.
Still tasty, though.
 
11:01 AM
Have been having the watermelon + rockmelon + honeydew juice the whole afternoon
me so healthy
 
Uunnnnnnnnnnnnnngh.
Honeydew.
I want to mix Honeydew and Kiwi.
 
honeydew & kiwi ... umm ... never tried, don't know what the mix tastes like
 
@ArneMertz uuu hello arne; how very correct has your code been? hitting that 80% mark?
 
@sehe lol
 
@Telkitty Try it. S'good.
 
11:10 AM
@sehe I'm so gonna use that.
 
is there any website specifically designed for post code for other users to review/look for bugs/etc.?
 
There's the Codereview SE.
 
Thank you
 
I should post sol on Code Review at some point in my life.
I don't know what my final project should be.
 
11:29 AM
@ThePhD something enjoyable?
 
@edition I enjoy sol. I don't know if they're going to allow me to work on it in 2 classes, even though the project is much larger than the two classes could ever hope to pitch for a library project.
Overloaded
compile-time overloading
This is stupid hard <_>
I hate variadics
 
@ThePhD But even though you hate them, they love you <3
 
Their implementation just doesn't make any sense.
They're all about being these things you have to unpack and you have to jump crazy hoops to introspect them
 
@ThePhD which compilers are you targetting?
 
You can't get lists of compile-time variables without first encoding them into types first, which is hell if you're using C++11 constexpr
 
11:39 AM
Err?
template<int foo> :P
 
template <IntOrStringOrDoubleOrMFP... foo>
 
> compile-time
> double
 
Whatever, you get what I meant.
 
I think that std::integral_constant is (usually) good enough.
The only time I wanted to write template<<ANYTHING>... Stuff> was when I was trying to, err, do inline checks for whether a piece of code compiles or not with actual templates.
I admit it's a stupid limitation, but I can't say I was hit by it a lot.
 
I need a list of MFP types and a value for each one.
 
11:43 AM
MFP?
Ah, member function ptr.
 
Member Function Pointer
Later it'll be regular function pointers too.
I'll probably end up with
template <typename F>
constexpr struct func { F f; };
And then just
template <typename... Args>
struct whatever {
   // Args::f on the inside
}:
Sure hope that doesn't break VC++'s fragile little shit heart.
 
11:57 AM
@ThePhD Wait for <auto... a>, there's a proposal out there
 
@Columbo Already e-mailed the author weeks ago.
 
@ThePhD Well, you should email him now, to ask about Jacksonville
 
Already did.
 
So?
 
I'm waiting for a second response. .-.
 
11:58 AM
Is .-. a smiley?
 
Yeah
> Thank you for getting back to me with that explanation. I think I'm with you, albeit I'm much more fired up about vehemently opposing the idea that we should make "auto" another word for "typename". It seems like a supreme waste of real estate and a bad design choice to make it behave like a type concept.

How did things go in Jacksonville? Did this paper get discussed? If you do need any help pushing things forward (especially if it's possible to make this hit C++17), I'd be more than happy to lend any help I can!
 
It won't make it into C++17 if it wasn't accepted in Jacksonville
But let me know if he replies, please
Or actually, nevermind, I'll just wait for the minutes
 
Would the minutes pop up in the place the usual papers do?
I honestly hope some dummy doesn't stop this from moving forward.
 
@ThePhD Nice.
Just be careful with expressions like "vehemently opposing", since you don't always know how the other person thinks about it. I'd rather use terms like "worried that this could escalate into.." or something.
 
@ThePhD Yep. Wait for the march mailing list, probably released on 10th of April.
 
12:09 PM
^ vehemently opposing is a bit strong tbh
 
@ThePhD If there is an issue with the approach, it better be postponed. We don't want to hurry.
 
@Borgleader I can use vehemently opposing because he's on my team. :D
To the outside world gentler, nicer words can be used.
@Columbo I want to hurry. I want to go fast.
 
Oh, I thought it was a mail for Bjarne.
 
@StackedCrooked Nah, author of the paper (James Touton).
 
12:27 PM
@Ven Ah, clojure vectors have fast access to the tail. I just tried a simple, not-too-intrusive variant of this idea, and the performance has more than doubled. Nice!
 
so fredo, how is wpf?
 
WPF developtment doesn't start for another 2 weeks or something.
 
so there is still time :)
 
Yes. And I need this persistent vector stuff ready for presentation on Friday.
Priorities, man...
 
I'm setting up CI to run UI-tests for control libs
No fun config but sweet now when it runs.
 
12:30 PM
UI tests mean mouse click simulation or something?
 
Yeah, makes much sense for wpf controls
Hard to unit test those things otherwise as it is hard to know what really happens in the framework
 
@ThePhD Calm down mate, you studied for a PhD, you should be patient
 
SPEEEEEEEEEEEEEEED.
 
I, for one, long gave up on getting my BA anytime soon
It feels like an eternity away
 
@Columbo Studied? Past tense? Did he give up? Did he succeed?
 
Ven
@fredoverflow see, it was a good idea of mine to suggest it :P
.oO( for once! )
 
@Ven There are quite a lot of interesting clojure videos on persistent data structures on YouTube. Most of them don't go very deep, sadly.
 
@fredoverflow As far as I'm concerned, his Uni fucked him over, so he quit (/cc @ThePhD)
 
I shall call him The PhP from now on!
6
 
1:49 PM
Anyone up for a pop quiz?
Without looking up the operator precedences, which of the following parentheses are optional?
((length - 1) >>> 5) & 31
 
the ones before & (second-guess)
 
So which ones?
 
mehTfOlla
 
2:12 PM
@набиячлэвэлиь I'll keep them anyway, because it looks weird without them.
 
@fredoverflow C++ doesn't have a >>>.
 
@Puppy That's why I posted the Java link.
 
2:37 PM
@fredoverflow No parentheses are optional when that kind of a question is a valid one.
I.e. when the order is not obvious at the first glance, parentheses are required.
This is the only valid answer to that question :P
 
2:54 PM
Jesus Christ is this room dead or what
 
Has Lounge been murdered? @Columbo is on the case...
@Griwes I like Kotlin's approach to this problem. Since nobody can remember the bitwise operator precedences anyway, they replaced them with methods:
(length - 1).ushr(5).and(31)
 
blergh
Parens are fine.
And the issue with non obvious ones can be eliminated by forcing people to add them where necessary can be solved by a proper code review process.
 
I think gcc and clang have warning options if you omit non-obvious parens.
 
@fredoverflow Very good. Having bit operations as a built in feature slightly perplexes me in high-level languages.
Bitsets FTW
In fact, << and >> to me are stream insertion operators, and it's just the numbers have this obscure operation that can be done with the same operator
 
@fredoverflow In Scala they are methods!
Infix ops FTW
 
user1804599
3:11 PM
@fredoverflow lol @ bitwise operator precedences
 
user1804599
 
user1804599
 
3:29 PM
Christian daycare lady: Do you play Xbox in front of your 3-year-old? Me: Yeah. Why? Lady: She told me Jesus got pwned. King of the noobs
 
3:49 PM
@fredoverflow Yes; not sure if they are there for cases other than && and ||, though.
@milleniumbug I am yet to figure out how to sanely allow custom operators in a parser that is supposed to be as stateless as possible (though making it more stateful might be an option. Or not. I have a lot to still figure out about my future language).
11
Q: javascript left-pad golf

m0saIn the wake of the left-pad npm package fallout, let's have a javascript-only code golf for implementing left-pad. Submissions are considered correct if they pass the original left-pad test suite (dependencies removed because npm): f('foo', 5) === ' foo'; f('foobar', 6) === 'foobar'; f(1, 2, 0...

 
LMAO https://t.co/ejLk5WJmBW
hahaha
more fun stuff
 
4:07 PM
@Griwes Not much of a fan of custom operators, although the only implementation I've used is the Haskell one.
I explicitly mention the operators in the imports so I know where they are from
 
@Borgleader Nice.
 
import Control.Applicative ((<*>))
 
@milleniumbug whenever I do that in a file in which I use Parsec, people look at me funny; for some reason applicative parsing they find unreadable, wtf
 
4:29 PM
Hey, someone made a proof-of-concept GCC fork for the callable pointer to member.
 
Well that shouldn't be too hard if one has some knowledge of GCC's internals...
 
@Morwenn That would save me so much work right now.
If tha tis indeed what I'm thinking of.
 
4:44 PM
Dammit, I found someone wrong on the Internet.
5
 
@R.MartinhoFernandes Smite them!
 
Already did.
 
.50 BMG > smiting
 
Wrote a four-paragraph long treatise telling some nationalist pig that he was wrong about the people living in his own country :/
Now I gotta do some work.
 
@ScarletAmaranth maybe they’d rather bang!
 
4:55 PM
@milleniumbug The parens are really annoying, ain't they?
 
@R.MartinhoFernandes link?
 
00:00 - 17:0017:00 - 00:00

« first day (1988 days earlier)      last day (2962 days later) »