« first day (1374 days earlier)      last day (3571 days later) » 

9:08 AM
this is pretty ugly code
 
that's an ambiguous statement
 
Nah.
 
this is pretty (ugly code) | this is ((pretty ugly) code)
 
latter
 
user1804599
(this is pretty ugly) code
 
9:12 AM
clearly the latter.
 
Yeah I don't see the ambiguity either.
 
clearly you should have written it in LOBJAN
or Newspeak
this is triple-plus ungood code.
 
user1804599
Newsqueak is cool.
 
@Puppy LOJBAN
 
whatever
close enuf.
 
9:15 AM
I don't know if my cl parser should throw errors or just print shit to stderr.
 
do not ever print shit to stderr.
always allow the user to handle the error however is best
 
I have a parse member function that catches the errors and prints to stderr and exits and a raw_parse one that lets the user handle the errors themselves.
 
meh, just drop parse and rename raw_parse to parse.
as long as you offer the bad behaviour, somebody else will use it that way and then other people trying to use that in a new way will be super unhappy.
 
I kinda like how it's set up currently idk
 
9:18 AM
std::cerr << a.name() << ' ' << t << ' ' << (void*)a.items.front().owner << ', ';
 
Otherwise you could pass in an error handler that defaults to one that prints to stderr
Idk
 
Guess the last character output by this.
 
by the way, thanks for that.
I was going to make a bad mistake and offer stderr/stdin/stdout as kinda-globals.
 
thanks for what?
 
now I just realized that they're as bad as any other global.
maybe I will pass them in to Main() instead.
 
9:19 AM
@Puppy And then you have to pass them around to everything.
 
@Griwes Which is just fine by me.
 
@MarkGarcia What's wrong with that?
 
"everything" shouldn't need to use them directly.
 
@Puppy You like having 3 additional arguments for EVERY FUNCTION?
 
user1804599
@Puppy same for the file system, system clock, current working directory and environment variables :v
 
9:20 AM
@Griwes If you're writing every function to depend on stdin/stdout/stderr, you're doing it wrong.
 
@LightnessRacesinOrbit Eh, I just discovered it's just some add-on I recently installed.
 
non-global stderr/stdout/stdin sounds pretty annoying
discourages print debugging in a way too
 
@Puppy I don't know if something deep down the call chain, in a 3rd party library doesn't want to print something.
So not to fall into such a trap, I'd have to keep passing it literally everywhere.
 
user1804599
@Rapptz You can still have a function debug_print of which the name suggests it mustn't be used in production, and that accesses some hidden global.
 
@Griwes It shouldn't be randomly printing shit if you didn't ask it to, and if you did ask it to, then passing in stdout as that means of asking it to seems fine to me.
 
user1804599
9:21 AM
Like trace in Haskell.
 
@Puppy So now, every function call looks like foo(lots, of, arguments, stdout, stderr, stdin); instead of foo(lots, of, arguments);,
 
@Griwes Like I said, if you have every function depending on stdout/stderr/stdin, you're doing it wrong. Only the top-level application code should deal with it. And that also applies to 3rd party libs, where assuming that dumping to stdout/stderr is fine is a broken behaviour.
 
user1804599
@Griwes No, because not every function needs access to those streams.
 
stdout/stdin/stderr is no different to any other variable.
 
@rightfold Passing it everywhere is better than refactoring 20 functions in a long call chain because we need to do something with the streams down there.
 
9:24 AM
those arguments are equally applicable to every other global variable.
 
Also
4 mins ago, by Rapptz
discourages print debugging in a way too
 
user1804599
Make a more clear distinction between side-effecting functions and non-side-effecting functions.
 
but we all accept that they're bad.
 
@Griwes What something?
 
@Griwes Do you always pass everything to every function because you don't know who might use it?
 
user1804599
9:25 AM
3 mins ago, by rightfold
@Rapptz You can still have a function debug_print of which the name suggests it mustn't be used in production, and that accesses some hidden global.
 
What function do you have that does not output to a stream but somehow actually does?
 
@Griwes I'm pretty willing to make a special exemption for debugging, you can provide a different function for it that explicitly only works when debugging.
 
@rightfold Then you've fixed the problem but not really.
 
user1804599
@Griwes Bullshit.
 
@jalf "here, have this Context object that contains every single thing you might need and is actually much better than just being implicitly global!"
 
9:25 AM
for example
 
Because you fixed it, but then you un-fixed it by introducing a global again.
 
@MarkGarcia What is?
 
I think that exit() is super bad but I'm happy to have debugbreak()
 
user1804599
You can be an idiot and still use it in production.
 
user1804599
But you cannot protect against idiots anyway no matter what.
 
9:26 AM
@ParkYoung-Bae shrug If you write all your code based on what you might need, then there's no helping you, I'm afraid :p
 
anyway I'm going to walk the mutt
thanks for that insight, @Rapptz
 
Hey man. Don't credit me for your bad ideas :(
 
@LightnessRacesinOrbit The yellow background in the link. Ahahaha, you thought I highlighted them.
 
user1804599
Remove all globals.
 
user1804599
No more fucking globals.
 
9:28 AM
Does every function need to call a third party library? Is every function a free function which has no access to convenient class members, or perhaps a closure or some other mean of storing state? There are plenty of ways to propagate additional parameters to the code that needs them without making them globals. You do it every friggin day (I hope)
 
1
Q: Extracting information from a c++ file

redaai know this question must be a little bit unclear but i'm going to try my best to explain my needs. first, i'm an apprentice developer since 1 year now, i'm on an internship and my boss want me to create a documentation generator based on code. documentation generator based on code ? the docum...

 
Anyway; if you pass me those to main, I'll just register them in some sort of a globally accessible function so I can care less about you thinking that output should only be done at the top level vOv
@jalf Yeah, I avoid global globals by using function local statics.
 
@Griwes you are a horrible person
 
@jalf Thank you.
 
user1804599
9:29 AM
The only reason you think they should be globals is because they've always been globals.
 
@rightfold It's singletons all over again :)
 
Shared pointers!
 
i think lol
 
But but I don't want to have to pass parameters to my functions! That's insane, imagine how much code I have to write!"
 
Someone asked me what C++11 features my library uses :v
 
9:30 AM
@Rapptz so what C++11 features does your library use?
 
I don't know.
 
@Rapptz string concatenation and bytes
 
The list is pretty big
@jalf I guess I am too. I use function local statics too.
 
@jalf Is @R.MartinhoFernandes also a horrible person?
 
user1804599
9:32 AM
Standard streams should at least be in a dynamically scoped variable.
 
user1804599
But preferably just passed around.
 
@R.MartinhoFernandes You also use function local statics!
 
Xeo
I wuv me some function-local statics \o/
 
Yes, so what?
I don't "avoid global globals by using function local statics."
3
 
Xeo
especially read-only, statically initialised function-local statics
 
9:34 AM
Oh.
I don't use them to avoid global objects.
 
Not sure how that makes sense (?)
 
There's a function local static that is only a function local static for header-onliness.
 
bad joke
I take it back
 
It's used to pass down to other functions.
 
9:35 AM
@R.MartinhoFernandes I know; it achieves header-onliness by avoiding a global that'd have to be defined somewhere.
:P
 
It's still a global.
 
What are C++11 features that VS2013 sucks at?
 
It's even named like that.
@Rapptz All of them? Conservative estimate.
 
Before I head out can one of you experts peak at http://pastebin.com/3d0nVDJi
for a couple seconds and tell me if anything sticks out like "WHAT THE FUCK!!!!!!!!!!"
 
@R.MartinhoFernandes But a function local static is not a global global. :P
 
9:36 AM
My report so far.
 
Without having to actually inspect te fuck out of the soam bitch
 
I'm pretty sure my creative uses of EnableIf don't work on VS2013
At least that's what ThePhD told me
Maybe he lied to me
 
@Griwes Anyway, the point is that it is only used at top-level. Everything else that uses it takes it as a parameter.
 
Xeo
Just assume nothing works in VS
 
@Rapptz Nope, doesn't.
 
9:38 AM
Sucks.
 
@R.MartinhoFernandes Sure, because it's more of a default_reporter_registry than the global_reporter_registry.
 
Btw, the report above marks things from VC++ 2013 Preview, but it means those features as of any of the versions in the graph.
@Griwes Same thing with the standard streams.
 
Griwes and me are the only people who don't want non-global default streams?
 
Xeo
IO <3
 
9:40 AM
@Rapptz Depends on which language you're talking about. It would be pretty crippling in C/C++ if they were suddenly made non-global. In a new language, where libraries can actually be designed for it? Why the heck would I want them to be global?
 
user1804599
I don't even want global cwd, env vars and filesystem.
 
user1804599
Fuck globals.
 
In C++ you're just screwed because you can't copy or move them to store by value, and storing them by pointer leads to "sometimes needs deleteing, sometimes doesn't".
 
Xeo
maybe_delete! :D
 
std::optional<std::ostream&>?
Why would you new up a stream anyway?
 
9:42 AM
To own it.
 
Xeo
Though you could store an ofstream directly, no?
In the variant, I mean
 
yeah
and call open
 
@rightfold Oh well.
 
user1804599
Wait, isn't that code broken?
 
@rightfold That's horrible. A global that functions are encouraged to mutate directly!
 
user1804599
9:46 AM
Evaluation order isn't defined at line 37 right?
 
user1804599
Fucking C++.
 
Not sure if I want to be chasing call stacks to find out who the fuck set the wrong stream.
i.e. there's still an invisible link between who picks the stream and who uses it.
 
@rightfold No it's not :D
 
@Xeo As std::ostream?
 
Xeo
No, as std::ofstream
boost::variant<std::ostream&, std::ofstream>
 
9:48 AM
@MarkGarcia Oh. Yes, that wasn't clear
 
user1804599
@ParkYoung-Bae Fuck C++ anyway.
 
@Xeo Yeah, but I was thinking of adding an extension point for custom streams.
 
Xeo
mh
 
@user2372903 std::cerr << "Usage - ./alertlogic_test \"Patern\" \n"; "Patern"?! Also don't hardcode the executable name as it may not actually be that.
 
@rightfold Does not matter.
 
9:50 AM
@user2372903 Some of your return statements have weird indentation.
 
I wish Windows argv[0] was sane
 
@rightfold Evaluation cannot be interleaved.
 
@user2372903 Otherwise it looks pretty good, though I haven't gone as far as validating the actual logic.
 
though I guess it's not too bad at times.
 
`@LightnessRacesinOrbit thanks for pointing that out. Forgot to remove that app name
 
9:52 AM
lol app name
 
@Rapptz I wish Windows argv[0] was sane
 
application name
weenie name
idgaf
 
\o/
It's refreshing to see someone actually writing C++
const references! vectors!
 
Everyone hated on me for not using them before lol
Originally just passing by value and & and alone.
 
@LightnessRacesinOrbit That can't be. Where?
 
9:55 AM
@LightnessRacesinOrbit Wuss.
 
Xeo
@LightnessRacesinOrbit const int& feels a bit weird, though
 
@jalf Yeah, it simply never occurred to me before that they should be non-global.
 
19 mins ago, by user2372903
Before I head out can one of you experts peak at http://pastebin.com/3d0nVDJi
for a couple seconds and tell me if anything sticks out like "WHAT THE FUCK!!!!!!!!!!"
 
@Xeo it does, yeah
 
9:56 AM
@LightnessRacesinOrbit Wuss.
 
It's funny that you can have volatile const int i = 42;
 
not really
 
> The following breakpoint cannot be set:

At animated_observer.cpp, line 354 ('start_animation(std::string name, const Src& src)', line 2), when 'name == "p"' is true

no operator "==" matches these operands
Fuck you too,.
 
gotta be up... in 4 hours.... polyphasic sleep, FTW?
lul, later.
 
So... there's no way to set a breakpoint only when a given string has a given value?
name.size() == 1 doesn't work either.
> This expression has side effects and will not be evaluated.
 
10:02 AM
@R.MartinhoFernandes #ifndef NDEBUG \ if (name == "p") { (void)0; } \ #endif with a breakpoint on the body..
 
Side effects my ass.
@LightnessRacesinOrbit Gee, great, I have to write the debugger.
 
@LightnessRacesinOrbit Easier to just call __debugbreak() directly.
 
@R.MartinhoFernandes Other than putting a boolean breakpoint on bool b = name.size() == 1?
 
@Puppy There you go
guess I was writing code to stand in for my lack of knowledge about this evil enterprise and its specific keywords
 
VS doesn't have GDB's equivalent of break if?
 
Xeo
10:04 AM
it does, but it doesn't seem to work in Robot's case
 
@Rapptz It does, but it depends on expression evaluation, which is very limited in VS.
 
I.e. it pretty much only works for variable or primitive value == variable or primitive value.
I don't actually know if it works for variable == variable.
 
it does.
IME it pretty much just works, as long as operator overloads or calling user-defined functions isn't involved ... or doing things with virtual functions/inheritance.
 
So, variables and primitive values.
 
I have occassionally managed to make it cough up the goods for stuff like uniqueptr.operator->()->f();.
 
10:10 AM
I've been desperate enough to try .operator->() before but don't remember it working.
 
Xeo
hm, lunch break. I should get some foodz
 
But yeah, once or twice I've had the odd function call to somehow work.
Dunno the pattern, if there's one.
 
honestly, it's really the derived class stuff not working that pisses me off.
@R.MartinhoFernandes AFAICT, it behaves substantially worse on stuff that's not in the same TU.
but it totally refuses stuff like vec.operator[](0).
 
Yeah, that's so freaking annoying.
 
VS is way easier to use than GDB, but the debugger needs some serious technical work.
kinda like the compiler itself, really.
I much prefer VS as a user but the technical aspects of the compiler are just...
they'd do much better and for much cheaper by just dropping CL and their debugger/intellisense and using Clang.
 
10:21 AM
Yay, fixed it.
Total fix size: 0 additions, 1 deletion. Total debugging time: about a day.
 
@redaa -1 for posting your question here
 
10:42 AM
@Abyx that's vote abuse
you're supposed to be voting on the post, not on your knee-jerk biases against a totally innocuous personal behaviour
 
@LightnessRacesinOrbit so what?
 
also that's a bad question.
 
@Jefffrey ezpz
 
user1804599
Lazy I/O is so awesome.
 
user1804599
10:57 AM
@Jefffrey 1 because it doesn't require a conversion to const int right?
 
I feel the sarcasm wind coming from east.
@rightfold Press "answer".
 

« first day (1374 days earlier)      last day (3571 days later) »