« first day (802 days earlier)      last day (4145 days later) » 

1:00 PM
@yetihehe Isn't that why it's amortized O(1)?
 
@irrelephant Ok, sorry, I've read more about amortized
 
@Zoidberg'-- As far as I can tell.
 
user142019
Spawn N universes where N is the number of possible vectors, each universe containing a unique vector, then if the vector is not the vector you want, destroy the universe.
 
user142019
That should be reasonably efficient.
 
hmmm
I guess I found the issue in Clang's name lookup function
> // FIXME: This really, really shouldn't be happening.
3
 
1:11 PM
lol
 
so basically
it turns out that Clang simply doesn't implement the functionality I'm using
time to start altering the Clang source
 
user142019
lol
 
sbi
: 6860850 I have never taught to a class of beginners, though. The programming beginners I had to teach were four people. I did have classes to teach C++ to, but those had (at least) one year of experience in Java.
Not that I think learning Java has helped them much on their way to a become good programmer.
 
@DeadMG you go puppy! Show them how to write C++! (you were going to submit patches, weren't you?)
2
 
@sbi There are many programmers which started out with basic. Learning ANY language is a way to become a good programmer, one just needs to learn more languages than one and know that there are many ways
 
1:23 PM
@yetihehe or learn a language that is capable of "many ways".
 
like assembly? Or lisp?
 
C++11. Multi-paradigm is the word :)
 
@rubenvb Perl? :)
 
Heck, I bet Python qualifies as multi-paradigm
 
And thus the great holy wars of "Which language is better" have begun.
 
sbi
1:26 PM
@yetihehe The thing is that, as you do when you start C++ by learning C first, they had to unlearn a lot of stuff. Also, Java fails to be able teach some IMO essential basic stuff, like the difference between pass-by-value and pass-by-reference.
I had once had a student — who failed my course! (no, this isn't a joke) — approach me afterwards to thank me because, in his third semester, this was the one course that had taught him the most about programming. I remember among the things he listed was that he never understood why, in Java, changing an int passed to your function has different results than changing an Integer (or however those are spelled, I never wrote a line of Java).
 
@rubenvb Perl follows the motto: "There more than one way to do it." In response, Python follows the motto: "There's only one (obviously) correct way to do it."
 
@yetihehe eh, no. You asked for examples. I have no preference. I know only one: C++, and only the little bit I have used before.
@StackedCrooked can't you program generically, OO, functionally, etc.. with Python?
 
@rubenvb Maybe you should know more ;)
 
sbi
Over the years I heard such things from my students: how they failed to grasp something in Java because it's hidden and unaccessible under layers of protection, and how they understood it once C++ spit a nasty runtime error into their faces.
 
@rubenvb I have no experience with Python myself. I just got that from Wikipedia.
 
1:28 PM
@yetihehe no time. Nor motivation. But I do know quite a bit of Matlab.
Of course, Matlab is a terrible language. It makes for a great calculator though.
 
C++ is not the answer for everything. That's the only thing I want to say.
 
Nobody ever questioned that.
 
sbi
@yetihehe This wasn't to say that you shouldn't learn different programming languages. You should. But especially you should learn different programming paradigms. (Syntax doesn't matter all that much.) It's important to have been exposed to languages like LISP, PROLOG etc., even if all you ever do for your professional live is programming imperatively. However, that doesn't mean any language in a set of languages supporting a paradigm is equally well-suited for learning that paradigm.
 
Xeo
It's not the answer to "write C#" with a gun pointed at your head. :D
 
Is that smiley a hidden reference to D? :D
 
Xeo
1:32 PM
lol, no
More like a reference to @sbi's former Twitter "about" text.
 
@StackedCrooked ruben did ;)
 
@sbi if you nuance your point of view just a little more, you could go into politics. ;-) (not to say I don't agree)
 
sbi
@Xeo At least I got it.
 
@yetihehe Spank him.
 
@yetihehe wut?
 
1:33 PM
@rubenvb > or learn a language that is capable of "many ways".
 
Xeo
@yetihehe And he said that he only knows C++ there.
 
user142019
I find it weird that my school teaches OOP (using Java) when most students can barely write a for loop.
2
 
sbi
@rubenvb Aw, c'mon, just admit it. The spanking won't be that bad, and, according to redneck fathers, it helps you forming a healthy character.
 
Exactly. What @Xeo said. I'm not qualified to comment on more examples.
@sbi I have no redneck fathers. I live on the right side (triple pun intended) of the pond.
 
sbi
@rubenvb As do I. And in >15 years I have never hit one of my many kids, no matter what they did. (It was a joke, silly!)
 
1:35 PM
is it a good idea to throw std::invalid_argument("arg"); in C++, like we do it in C# ?
 
sbi
@rubenvb I'd be a terrible miscast.
 
@Abyx I don't use it often.
 
user142019
@Abyx I never use it.
 
user142019
I never check for "invalid arguments". In my documentation, invalid argument = UB.
 
user142019
How would you pass an invalid argument, anyway?
 
sbi
1:40 PM
@Abyx [Björn](stackoverflow.com/users/160206/) and I just put lots throw std::runtime_error("blah blah"); into some new code. — but all with a big // TODO! next to it, because they need to be replaced with prper exception types later on.
@Zoidberg'-- std::ofstream file("...") <== there, invalid argument.
 
user142019
I see that as an I/O error; file not found.
 
user142019
Use a path data type for paths. Problem solved.
 
sbi
@Zoidberg'-- It's not a valid file name argument.
 
I need something like an assert, but I want it to work in release mode, just in case
 
user142019
Prevent invalid paths from being constructed.
 
user142019
1:42 PM
@sbi Really? I can create a file named ... on my system.
 
so I thought of using throw std::something instead of assert(x && "someting");
 
You can use your own assert instead of using the stock one, then you control when it's enabled or not. (And you don't have to call it assert either.)
 
also, throw in "noreturn", and assert() isn't
 
sbi
@Abyx But an assert is different from an exception in that it inevitably aborts the application, while an exception can be caught, and the application can muddle on. Which one do you want`(And why?)
@Zoidberg'-- Yeah, but that line of code was to run my toaster's chip, which doesn't even provide a file system, let alone allows files named "...". That's why the argument is invalid.
 
assert won't abort application in production
 
sbi
1:45 PM
@Abyx That statement needs a lot of qualification. To be precise: The assert macro in <cassert> won't abort if compiled with NDEBUG.
 
user142019
Write your own assert and problem solved.
 
sbi
You can simply compile your code without NDEBUG. Or create your own ASSERT macro.
 
user142019
Or #undef NDEBUG before #includeing <cassert>.
 
well, consider this code:

enum X { a, b, c };
Y foo(X x)
{
    switch(x)
    {
    case a: return ...;
    case b: return ...;
    case c: return ...;
    }

    what should I write here?
}
 
sbi
That needs an assertion, if the default branch should never be reached.
 
user142019
1:47 PM
Make it an enum class so it's strongly typed. Then you cannot pass an invalid value without UB.
 
(I wrote throw std::invalid_argument("x");)
 
sbi
Often, though, this kind of code indicates lack of polymorphism.
 
@sbi but with assertion I need write a return statement
 
sbi
@Abyx Just write return Y(). Who cares? It will never be reached.
 
mornings
 
user142019
1:49 PM
afternoons
 
@sbi it just won't compile without return
 
sbi
@NikiC It's almost 3pm. And it#s the same for you, IIRC.
 
compiler cares.
 
user142019
@Abyx turn off -Werror like any decent person.
 
Stick in a [[noreturn]] for your assert and you're done. Expect warnings for those builds where the assertions are preprocessor'd out I suppose.
 
1:50 PM
@Zoidberg'-- wat? never.
 
user142019
Also what compiler can't understand assert(false).
 
@sbi Yeah, but I stood up two hours ago, so it's still morning for me ;)
 
sbi
@NikiC I only got up one hour ago. That doesn't matter, however, because the sky says it's going to be evening soon.
 
@LucDanton and where should I put it?
 
@Abyx [[noreturn]] void assert(/* pick your poison */);
 
1:51 PM
@sbi Okay, then it is evenings to you ;)
 
user142019
@LucDanton Can't you do assert(false) [[noreturn]];?
 
user142019
No wait that doesn't make sense.
 
@LucDanton assert is in <cassert>, I don't modify it.
 
user142019
assert(false);
throw 42;
 
also it's goddamn macro
 
sbi
1:52 PM
@Abyx The macro will have to call a function.
 
I GUESS THERE'S NO SOLUTION THEN?!?!?!
 
@Zoidberg'-- nice. and why not throw std::invalid_argument?
 
sbi
Uh?
 
user142019
USE enum class ALREADY
 
sbi
@Abyx Because that can be called?
 
user142019
1:53 PM
Compiler should warn about use of uninitialized variable, and an enum class is not implicitly convertible from int.
 
it doesn't matter here if it's enum class or not
 
user142019
If you handle all enum class values in a switch and return from all of the cases, the compiler shouldn't complain.
 
sbi
So, for one who has never written a line of C++11 (except the (inf)famous [](){}(), of course, for jokes), and who has, at the moment, no opportunity to program in C++11, can you, in one short paragraph. tell me what an "enum class" is all about?
Oh, wait. Never mind.
I will make this an SO question and rake in lots of rep.
You guys go and sharpen your knives pens already.
 
user142019
Using uninitialized variable is UB, and you cannot construct an invalid enum class without explicit casts.
 
sbi
Except it will probably be closed as a doop. :(
 
user142019
1:57 PM
Or you know, make your code self-documenting:
 
ok, enum class, huh... lemme check it
 
user142019
[[noreturn]] void not_reachable() { assert(false); std::exit(1); }
 
user142019
default: not_reachable();
 
sbi
@Zoidberg'-- In practice, though, this helps nothing. I suppose 50% of the enum types I have seen had to be casted. (For example, how else do you stream them to disk and back?)
 
@sbi strings!
 
user142019
1:58 PM
@sbi Using a custom deserialization function, which throws an exception if the read value is invalid.
 
in c++11 you can defined the type in which the enum is encoded
 
sbi
@Zoidberg'-- Shrug. Of course everybody does that! That doesn't mean this code can't have bugs. Or time constraints, and users that fiddled the files.
 
user142019
Of course, if you don't care about correct code use a cast.
 
sbi
@rubenvb enum color { red, green, blue }; color user_color = convert_from_string("yellow");
 
enum class Enum2 : unsigned int {Val1, Val2};
and then no more cast is needed ? no ?
 
2:01 PM
@sbi show an error! Blow up the world! Summon the devil! End the Mayan calendar!
 
@sbi Enums that don't pollute the namespace and don't have implicit conversions.
 
user142019
data Enum2 = Val1 | Val2 deriving (Eq, Show, Read)
 
user142019
:^)
 
...not in fucking VC++. switch doesn't care about enum class.
 
sbi
@rubenvb Yeah. And @abyx was asking about exactly this: how to blow up the world. That's what we are discussing. So what was your point, again?
 
2:03 PM
Are we/you seriously discussing how to handle malformed input?
 
user142019
@sbi exception.
 
user142019
Parse error. Unexpected token yellow.
 
sbi
@Zoidberg'-- See my reply to @ruben.
 
@Zoidberg'-- It's a rhetorical discussion.
again.
 
user142019
THEN WHAT'S THE POINT
 
2:05 PM
ok... once again... here is the code:

enum class X { a, b };
int foo(X x) {
    switch (x) { case X::a: case X::b: return 0; }
}
//  warning C4715: 'foo' : not all control paths return a value
 
user142019
lol
 
how should I fix that warning, for VC++ compiler?
 
user142019
[[noreturn]] void not_reachable() { assert(false); std::exit(1); }
 
@Abyx you have no default
if x isn't X::a or X::b, you have a malformed function call return thingie
It's not VC++ specific.
 
@rubenvb I don't have a valid return value for default.
 
2:07 PM
then throw
or create a valid return value which is handled like an error code.
 
throw what?
 
sbi
@Zoidberg'-- The point is that, in real code, you might end up in the default branch of a switch that (used to) cover all possible values. Whether this is due to inappropriate casting or because someone added a new value but forgot to hunt down all the innumerable places that enum was used doesn't matter. It happens, it's an error, and you will have to deal with it.
Here, you guys get your self some rep for Christmas.
 
@Abyx something you catch somewhere else in your program.
 
user142019
enum class is a strongly typed enum that doesn't implicitly convert.
 
sbi
@Abyx Oh FFS, be a bit creative, will you? assert(false); throw "Fuck you, compiler!";
@Zoidberg'-- Hey, I made that an SO question!
 
Tek
2:09 PM
lol
 
user142019
@sbi Hey, I know!
 
@sbi I want to close that question for the sole reason of "SEE THE DAMN C++11 WIKI PAGE"
 
Tek
Mornin' everyone... err good day to the world
 
sbi
@Zoidberg'-- Hey, then answer upvote it!
 
user142019
IMO [[noreturn]] void not_reachable() { assert(false); std::exit(1); } is most descriptive.
 
2:10 PM
or "GET A FRIGGIN' BOOK"
 
@sbi -1 for assert(false) because "assertion failed: false" makes no sense =\
 
@Zoidberg'-- except that no compiler supports C++11 attribute syntax.
 
sbi
@rubenvb I could go there and read that. Or I could chat here with you guys.
@Abyx Oh FFS, be a bit creative, will you?
 
and assert(!"Fuck you, compiler!"); throw "Fuck you, compiler!"; violates DRY
 
user142019
@rubenvb except clang.
 
2:11 PM
not me
 
Tek
prolly the guy who who linked the page where his question was already answered
 
sbi
@ScottW Go ahead and do it. I would, of course, downvote such a silly one-liner that doesn't answer the other half of the question, but never let that stop you.
 
@Zoidberg'-- oh right, 3.2 was released.
although their cxx_status page still lists "generalized attributes" as a no.
 
user142019
[[noreturn]] is certainly supported; I have used it and it gave warnings when I used it incorrectly.
 
@Zoidberg'-- that's probably cause noreturn is also usable after the function param list
 
sbi
2:16 PM
@ScottW Nope, I don't think so.
@ScottW That guy has >1.5k rep. Shouldn't you be able to vote to close, rather than just downvote, with 1.5k??
Anyway, where's the link to that page that lists the privilege coming with your rep? It's never been really easy to find, but now I can't find it at all.
 
@sbi nope, close votes require 3k
 
sbi
@Abyx Ah. Oh well.
 
sbi
@Abyx Where's that link hidden now?
 
@sbi move mouse over your name, click "privileges"
 
sbi
2:22 PM
@Abyx Oh damn! Thank you.
@ScottW For years.
Although ISTR it being accessed through some non-obvious link from under your avatar on your profile page.
 
Ho ho ho
 
sbi
Thanks, @ruben, I considered doing that edit myself, but then thought as the guy with the question I'd better not fiddle with other people's answers.
 
@sbi lol np.
 
sbi
Well, it's Christmas. I guess I should allow for questions taking longer to be answered.
 
Ok, dns-fix is the best named utility ever. Guess what just fixed DNS for me after upgrading Linux Mint?
 
2:36 PM
I don't know, runlevel?
 
lol
 
user142019
@Griwes Vim?
 
Some kind of kexec magic?
 
@Zoidberg'-- No, Vim would just make the problem bigger.
 
user142019
Paint?
 
user142019
2:38 PM
I know! MegaUpload Download Manager!
 
I concur.
 
user142019
@ScottW No, you're not. Stop lying.
 
user142019
 
user142019
I'd never wear that.
 
Tek
lol
I'd wear that to a party or something
 
2:44 PM
Wow, my question from 2011 just got answered.
 
Since when is netcat "potentially dangerous tool"?
 
user142019
Aug 12 at 17:05, by DeadMG
thank you for dumping your link in Lounge<C++>, kindly receive your express downvote, courtesy of DeadMG Incorporated
 
lol
@yetihehe Since it's commonly used as a backdoor
 
user142019
You don't tell me what I care about.
 
2:49 PM
Go away please
 
user142019
Hey GTFO.
 
@OlegOrlov No thanks. Have a flag.
 
user142019
lol
 
right
 
user142019
ITT: capture the flag.
 
2:51 PM
lol
 
See, that's coordinated flagging
 
so: what are the name lookup rules for unqualified lookup in the global namespace?
 
user142019
> This user has been automatically suspended for posting inappropriate content and cannot chat for 29 minutes.
 
kirby dance
 
what a looser
 
user142019
2:51 PM
Achievement unlocked.
 
Cue whiny meta post
 
@CatPlusPlus Linky? I don't see it.
 
sbi
I didn't originally downvoted him (hey, everybody is allowed one mistake, right?), but after him misbehaving so badly here, I joined the mob burning his question.
 
user142019
@DeadMG (It's a prediction.)
 
user142019
2:53 PM
lol -6 for a question that may be perfectly fine (I didn't read it).
 
well, you can't downvote someone in chat for being a dick
so you have to downvote them on the main site for being a dick
 
user142019
:P
 
Haha sockpuppets
Let's flag for mod and get him a global ban :toot:
 
@DarthNihilus tl;dr please
 
@Abyx We downvote people because we have no sex and a small penis and similar sexual shortcomings.
 
2:55 PM
Or do we have no sex because we downvote people
MYSTERY
 
correlation doesn't imply causation in any case
 
user142019
Time to expand the brown list, I think?
 
It's the same kind of idiot that proclaims that PVP in games is sociopathy
 
anyway, don't use spaces or stars when you write "fuck". it's really hard to read
 
He's a moron
What do you know
Also bloo bloo hurtful words
 
2:57 PM
I know he's a moron
you just told me
 
user142019
Guide to Lounge<C++>
====================

Are you a moron?
Yes? GTFO.
No? Enjoy your stay.
 
No but really, does this qualify for global ban? It is suspension circumvention
 
@Zoidberg'-- what are you doing here then?
 
yep
 
Hi Tim :v
 
user142019
2:58 PM
lol
 
user142019
@Abyx I'm a star whore.
3
 
no hiding on the Starboard
 
sbi
@CatPlusPlus Yeah, I had the same thought. Also: twitter.com/tweetsbi/status/283949621766680576
 
user142019
@DeadMG yes hiding on the Starboard
 
DID I JUST SEE FLAGS IN THE C++ ROOM?
 
user142019
3:00 PM
THEY WERE LEGIT UNLIKE MOST FLAGS FROM THE PHP ROOM!
 
sbi
@Abyx What an apt question!
 
user50049
Processing ....
 
@Zoidberg'-- YOU GOT A POINT THERE, ACTUALLY
 
WHY ARE YOU YELLING
 
user142019
ASK NIKI
 
3:00 PM
WHY CAN'T I SPELL
 
@NikiC do you use shift or caps lock?
 
user142019
BECAUSE YOU'RE A CAT AND CATS DON'T SPEAK ENGLISH
 
@Abyx I use shift ^^
caps lock is the most stupid thing ever
 
user142019
Caps lock is control on my machine. I remapped it.
 
it's never useful but you hit it by accident often enough
 
sbi
3:01 PM
@NikiC Yes. We like to spread the rumor that we dislike flags, but that's only when people are flagging us. Whenever some morons enter the room and misbehave, we all jump on them like an angry gang of chimps, until he's flattened and banned.
 
user142019
I never use my control key, in fact. Only caps lock.
 
sbi
Oh, @TimPost, you were indeed fast! Happy xmas, and thanks for looking into that guy!
@NikiC Except for when you write C for a living. Then you need CAPS LOCK.
 
@sbi For all the MACROS?
 
sbi
That was a joke, Silly.
 
Macros are uppercase because they make people so angry
 
3:04 PM
@CatPlusPlus they make people even more angry if they aren't uppercase
 
user50049
@sbi No worries, yeah, this needs a bit of attention on my part
 
sbi
@EtiennedeMartel I installed Civilization (III, of course!) on my son's machine yesterday morning, before breakfast. Then I thought I'd have a look if it even starts. Man, was I hungry that evening!
@TimPost Thanks. What an idiot.
 
hmm
maybe instead, I should not use unqualified lookup
well, I certainly didn't consider the possibility of ADL applying
 
sbi
@StackedCrooked "Anyone who consults a shrink should have his head examined." — Robert Heinlein
 
user50049
@sbi No problem, it's been handled.
 
sbi
3:11 PM
Thanks, Santa, Uncle Tim!
 
So I'm in Madrid right now and I found internet!
 
sbi
Uh, FF just crashed on me. Fortunately, it opens all my... hunts down the number ...99 currently open tabs in six browser windows.
 
free internet
and it looks like I just missed a troll too :)
 
sbi
@Mysticial What you're in Europe?
 
@sbi Yeah, for a day, then I'll be in Africa. :)
 
sbi
3:17 PM
Coming from the US, Madrid is just around the corner from the robot. You should visit him!
 
Ell
@Mysticial wow africa, why are you there?
 
@Ell Not there yet. Tomorrow I fly to Casablanca.
 
Ell
Ooh exotic
 
I'm only in Madrid for a day to break an other 4-way connection.
I've already been flying for 24 hours.
 
sbi
@ScottW Do you have any idea how many places named Berlin the US has? Still, the unqualified "Berlin" name-dropped here will always mean the German capital.
> Sandwiches Taste Better When Other People Make Them — UberFacts
Although "uber" sound stupid to me. See this.
Now this is a nice xmas tree!
 
3:29 PM
And I'm jet-lagging like fuck... Need sleep.
 
aargh
fuck you Clang, no matter what I do, you can't find a simple name.
 
sbi
It has to have an elaborate Klang, huh?
 
Apparently, Madrid isn't a big enough city to get direct flights from the US. So I had to go all the way to Switzerland.
Goddamn long-ass flights + layovers...
 
long trip
 
@sbi That's a really badass tree. Can claim it as both presents and a tree. And you get to give your kid bonus points if they can remove a book without ruining the tree.
 
sbi
3:35 PM
@ThePhD Um. What can I say? It's not mine. Sorry.
 
SFO -> EWR -> ZRH -> MAD ... I think that's the first 3-way connection I've ever done. 24 hours total.
 
@Mysticial Sounds beefy. Did you bring toys to occupy yourself?
Were their chargers on the plane?
 
@ThePhD Yes, but I didn't get to use them because some shit happened back at SFO.
 
:c
Booo.
 
For a complicated reason, we didn't have seats assigned on any of the flights.
So we had to standby.
 
3:38 PM
.... o_O
Nice.
 
We got in at the last moment. But because were were last in the plane, they forced us to check in our hand-carries to the final destination.
I basically told them fuck you, I need to pick it up at Newark. They told me fuck you we can't do that. So I said fuck you.
End result: I had nothing but my laptop and my DS all the way to Madrid.
 
Ell
@Mysticial what did they take off you? o.O
 
Because of the hurry, I forgot to take all my valuables out of that carry on. So that thought of losing all of it was with me until just a couple hours ago when I finally picked it up at the baggage claim - nothing stolen.
@Ell They took all our roller hand-carries.
 
Ell
phew
 
So I had to grab a plastic bag and take my laptop out.
 
Ell
3:41 PM
oh
 
My fucking 17in. laptop - heavy as fuck.
Had to carry it all the way to Madrid.
 
Don't you have a backpack or shouderbag or something?
 
@ThePhD Nope, it was all in the roller bag. The backpacks were in the check-in luggage for use when I get to Casablanca.
Wasn't planning on using them on the flights - since I'd have my roller hand-carry.
 
Ah
 
Normally, I'd have my laptop bag too. But all flights outside the US have retardedly low weight limits - and the bag itself is already halfway there... so...
I mean like - 7 kg?!?! Like seriously, my empty laptop bag is already half of that.
 
3:46 PM
FUUUU
no wonder Clang wasn't finding anything
I was performing name lookup before I parsed the fucking file.
 
I'm used to hauling around 50-pound carry-ons in the US. I learned the hard way a a few years back that I can't do that outside the US.
 
@Mysticial Ditto. 7 KG would be like paper.
 
@ThePhD Exactly.
 
Ell
When we fly to spain, we have hand luggage only :3
@DeadMG trololol
 
@DeadMG Get owned. :P
 
3:51 PM
right
so (irritatingly) I can find ::f but not f.
oh well
that will have to do
 
yo
 
Ell
Hi
 
sup folks
 
Ell
Hey :)
 

« first day (802 days earlier)      last day (4145 days later) »