« first day (1377 days earlier)      last day (3563 days later) » 

12:00 AM
terrible
 
user3010322
Hey, hey.
 
absolutely terrible
 
user3010322
On the bright side, I made userdata temporary.
 
no excuse will make it less terrible
 
user3010322
You don't even have to keep it around.
 
user3010322
12:00 AM
So storage costs are basically near zero.
 
@MichaelBurr Thats a good question, but at the end of the day a void* is easier to maintain then the inserting several lines of typedefs and manually writing out the namespace. If this works, everything would be good. — Mikhail 47 mins ago
 
Mikhail talks here.
He's more of a C guy if anything.
 
I like how he writes "easier to maintain" but actually means "easier to write"
 
Ell
12:18 AM
Evening all
@rapptz I've found Skype on linux better than windows. It had more useful features. But maybe not anymore
 
You're delusional.
 
Ell
Maybe :P
 
haha 7 stars
you fucks
> You can’t add code to ducks.
> You can’t refactor ducks.
> Ducks don’t implement protocols.
loooool
 
i have no words
 
Ell
12:34 AM
I understand how continuations are used a whole lot better now
 
@Ell continuations?
 
@Borgleader what a cow
In computer science and computer programming, a continuation is an abstract representation of the control state of a computer program. A continuation reifies the program control state, i.e. the continuation is a data structure that represents the computational process at a given point in the process's execution; the created data structure can be accessed by the programming language, instead of being hidden in the runtime environment. Continuations are useful for encoding other control mechanisms in programming languages such as exceptions, generators, coroutines, and so on. The "current continuation...
@Borgleader (NFI)
sounds like a total bunch of shite
 
@LightnessRacesinOrbit doesnt sound all that useful =/
Last panel is relevant to the Lounge
 
Ell
@borgleader you can implement any control structure with them
I wrote try catch
And unidirectional coroutines in ruby
 
> well if there's no definite speed advantage to adding const, then there's no incentive
^Wat
 
12:43 AM
the 1920s called
 
Ell
And im going to write a thing that turns a synchronous thing asynchronous
 
@Ell Will do you do it straight away?
 
Ell
@lightness I won't. I will eat breakfast first. And sleep before that
Also I'm so stupid I applied for a schi
Scholarship at an SSD company
 
I love you
 
Ell
But they are motor drives not data drives :3 not that I wouldn't take it but my application is going to look pretty odd. Serves me right for not researching enough :P
@lightness wow I just got that.
Boy I'm tired
Sleepy time
 
12:55 AM
@Ell oh dear
@Ell me too
 
broke my iPhone, wonderful
 
that is, indeed, good news
@vsz: anonymous structs can be used to alias struct members. Consider this point type: struct Point3 { union { struct { float x,y,z; }; float arr[3]; }; }; Point3 pt; pt.x = 3; pt.arr[0] == 3; // anonymous struct allows this Convenience is the advantage — Paul Ryland 3 hours ago
legal?
is that a common initial subsequence?
probably. definitely?
 
1:14 AM
It looks legal
but you probably couldn't interchange them
 
@LightnessRacesinOrbit I've seen this arrangement before, pretty sure it's legal.
 
16
Q: Performance issue: Java vs C++

realUser404I have always heard that C++ was way more efficient than Java (and that is why most games are developped in C++). I wrote a small algorithm to solve the "Eight queens puzzle" in both Java and C++, using the exact same algorithm, and then started to raise the number or squares. When reaching chec...

another shitty performance comparison
this time on the hot network question list
 
@Rapptz IIRC this week's top question in the newsletter was "why is while(1) faster than while(2)"
 
yeah another bad question
 
why do people try so hard to optimize these small things? Seems like a lot of effort
 
1:19 AM
baiting
 
1:39 AM
Good morning.
@Crow Simply because they don't know enough.
 
What do you mean with "try to optimize"? Using std::list doesn't even count as trying.
 
Iunno the arraylist detail seemed somewhat obvious and I'm not great with C++... An arraylist is like an array with indices, no?
 
1:58 AM
Simple question: If a member of a class is defined outside class body, shall I put it in header file or source file?
Initially I put it in header , and compiler gives me warning. So I am just confirming that I shall put it in souce file.
 
@Crow As far as micro-optimization goes, it's simply the wrong thing to optimize.
Since it's a solved problem for compilers.
The things you micro-optimize are the things that compilers can't do.
But stuff like ArrayList vs. LinkedList isn't a optimization.
 
Hmm..
Should --help be automatically provided?
 
well it's kind of like saying "the racetrack was the same length, but I drove faster around it in a racecar than a pickup truck. What's the deal with that?"
 
..?
 
der, doing python again... python file.py --help always brings up something
 
2:07 AM
it shouldn't
only those that use optparse or argparse do
 
Micro-optimizations that the compilers can't do (well) are:
- Vectorization (unknown alignment, memory conflicts, inefficient memory layout)
- Scheduling of large amounts of straight-line code. (NP-complete)
 
@StackedCrooked That tool looks cool.
 
@MarkGarcia Kcachegrind is pretty cool on Linux.
This is qcachegrind a derivative which works on Mac.
 
@StackedCrooked That's pretty cool.
Admitted, it's been at least 4 years since I've run a profiler on pi program. I should probably try it again at some point. I might find some surprises.
 
2:13 AM
how do you find out what's slow then?
 
holy shit British accents are annoying
 
@Rapptz My pi program done using bottom-up programming. Top-down is the one where you don't know where the bottlenecks are and you need a profiler to find them. Bottom-up starts from the theoretical maximums and you minimize your losses as you build up the app.
Top-down is the method that is taught as "proper" programming. "Make it work first, optimize later."
 
Still, why not run a profiler to see if your theory is met in practice?
 
@Rapptz Like I said. I should. There's a lot of code that was bottom-up written 4 years ago. Now the bottlenecks are likely to have shifted with the new hardware.
 
I feel like things should be selectively optimized. If someone uses it a lot, it's worth optimizing
 
2:17 AM
I wonder if Doxygen properly documents private inheritance.
 
@Crow I've had this thought for a while. What if there are no hotspots in your code, but your program runs slowly?
 
I've been looking for a tool to detect CPU caches. Then I realized the traditional profilers work by taking snapshots every few milliseconds and give each a function a score according to the number of times it was active during a snapshot. This means CPU cache misses are implicitly taken into account.
@MarkGarcia What if everything is a hotspot?
What is hot and cold? I don't know anymore. Please God help.
 
That.
 
everything is like... something man
 
Raising MTU from 1514 to 9000 increases my TCP test speed from 17Gbps to 36Gbps.
 
2:22 AM
Seems like Doxygen does not document private inheritance.
What a pain
 
Private stuff should not be documented.
 
..?
I said private inheritance
It's a form of composition
 
It's also private.
 
Not in the usual sense no
if I do using base::function; it's now public
 
It's an implementation detail, IMO.
 
2:24 AM
A class has access to its own privates of course.
 
It's not
I'm exposing it to the public API
 
I makes sense that Doxygen only documents the parts that are publicly accessible from an API.
 
It is publicly accessible.
 
How so?
 
2:26 AM
You made base::one public.
 
:|
2 mins ago, by Rapptz
if I do using base::function; it's now public
 
@Rapptz Ah, using. I doubt Doxygen could handle that.
 
Doxygen still doesn't document it
That's what I've been saying the whole time
 
SWIG would find it.
 
I'm unaware that SWIG is a documentation tool
 
2:28 AM
Now now.
 
@Rapptz We're just trying to prevent you from going to a slippery slope. :P
Jeff Atwood's rule of three is kind of useful for testing.
 
I don't wanna rewrite this just to please doxygen ._.
 
If doxygen doesn't find it then you'll have to find a way around it.
Btw, the maintainer of doxygen accepts user patches.
A colleague of mine submitted one a few months ago.
 
I don't think I want to browse the doxygen code base lol
 
Hinting the Lounge into creating a C++ documentation tool.
 
2:31 AM
@MarkGarcia it'd be an interesting group project
but
libclang is the only way to make the work sane
 
You could simply redefine the method in the derived class and delegate to the private base class.
 
@Rapptz Yay! We got one support!
 
Meh, a documentation tool is not very exciting.
 
anyway
I can't even get public inheritance to show up
So chances are I missed a setting somewhere in this test Doxyfile
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
# The default value is: NO.

INLINE_INHERITED_MEMB  = YES
 
dat MEMB
And INLINE_INHERITED_MEMB was suggested in the comments. Without further replies.
 
2:36 AM
yeah I saw
the answer is incredibly shit too
well
after fixing all the settings
it shows everything.
Even without the using statement
what a pain
I hate you doxygen
 
I don't get how phone apps are supposed to work...
 
Cool.
 
Can anyone take a screenshot
I found it through google but it's removed for some reason
:|
nvm found it through cache
no answers
I guess it got deleted for inactivity.
 
Lightness just edited one of my answers.
He changed a comma to a semi-colon.
 
My condolences.
 
2:47 AM
;_;
 
TIL I learned about Safari's "Export to PDF"
..it sucks
 
lol
editing the HTML by hand
それは凄いね
 
so what is bcrypt? What makes it special?
 
TIL typing Japanese on Debian is hard
had to use google keyboard thing on translate
 
Japanese typing on Mac is well implemented.
 
2:52 AM
well I haven't actually looked for a Japanese keyboard
I just decided to type on a whim
 
@Crow Perhaps every answer on security.SE contains it.
 
so then. It's good?
 
@Crow Yes. Much better than our home-brewed solutions. Search security.SE and you'll see.
 
why does python have so many THINGS?
 
は is "ha" but pronounced as "wa" when used as a particle. It's interesting how seemingly confusing things are very quickly internalized.
Suppose you have a password that is only 8 letters long and a dictionary word. Like: "auditory". How is this password easier to guess than 12 letters of random characters? Assuming the system only allows one login attempt per second and the attackers don't know that my password is 8 letters long and dictionary word, then why would it be less safe?
Stupid question probably.
 
3:10 AM
No, stupid problem. We need something much better than passwords.
 
two factor authorisation is pretty decent.
 
I always use the US president's name as my password. This way I get a new one at least every 8 years.
 
lol
 
lol
 
I'm not sure how to design the API for subcommands for the command line parser.
The old way I did it used private inheritance but it seems Doxygen is bad in this regard.
 
3:23 AM
@StackedCrooked lol
 
3:40 AM
why does my dog stare at me so much?
 
Is there any standard algorithm (or something built with one) that will do a copy from first to last, but only up to N times?
So it stops when it hits the end of the range or when it's copied N things
 
std::copy_n
 
@Rapptz Sorry, I should mention it's an input iterator
 
oh nvm
 
Can't calculate the number up front
 
3:47 AM
use copy_if
 
Good point. A lambda would work well.
 
might not work though
 
I know I thought about copy_if. Not for long enough I guess.
It's completely acceptable to do any extra iterations without actually copying anything instead of breaking.
Well, it seems to be doing ok. Much better than when I forgot copy_n doesn't care if the istreambuf_iterator it was given hits the end of the file.
 
hrmph. Would getting better at calculus make an altogether better programmer?
 
4:56 AM
yeah, a lot of what you do is sufficiently complex and algorithmic, so while there may not be any direct analogs in programming (though there also might be) the operations and procedures that you learn require a similarly high level of critical thinking that programming does
 
0
A: How can I parse C++ to create an AST?

John ZwinckYou can use GCC-XML to generate a fairly easy to parse XML representation of most (but not all) C++ code.

TIL
 
something like evaluating a symbolic integral is a multistep process requiring very algorithmic thinking and careful planning and consideration at each step to accomplish your goal, as does programming
 
@MarkGarcia whoa
Also how funny
We were talking about documentation tools
but an issue was parsing C++
 
:P
Yeah. Must be a sign. Or is it called fate?
Ok, so shitty connection swapped the two messages...
 
the AST output from clang is pretty good
just tried it
 
user3010322
5:27 AM
WTB zipWith in C#.
 
user3010322
Wonder if I can IEnumerable over 3 things at once with LinQ...
 
user3010322
var found = false;
 
user3010322
was bool too hard to put there?
 
user3010322
Wonder if there's a TupleEnumerable..
 
@Puppy Yes, it's build from svn but it's not a trunk version. It's from tags/RELEASE_34.
 
user3010322
5:37 AM
Duck
 
user3010322
I don't know how to manually iterate in C#...
 
Goose.
 
user3010322
Do I call MoveNext before I start?
 
@ThePhD That's a virtue.
 
Never thought I'd write a function called "clear_and_leak()".
It clears a unique_ptr member and (intentionally) leaks the pointer.
 
5:40 AM
@Mysticial reset()?
 
I've replaced a function-local static with leaked function-local static.
 
nvm
 
No more cry.
 
@MarkGarcia It's actually calls .release() and does not use the return value.
 
@Mysticial release?
Ah.
 
5:41 AM
@StackedCrooked yes
 
Why do you leak? Are you basking in your mountains of RAM?
 
@Mysticial Why leak?
 
I'm doing a small refactoring of the swapfile code in y-cruncher from C to C++ RAII filehandles.
During a stack unwind from an exception, all the files will get destroyed by RAII.
But I need to preserve a subset of them for the purpose of checkpointing.
lol
I'm sure there's a better way to approach it, but there's bigger problems that need to be fixed.
In the old interface, I simply don't call free() on the file handle struct.
I think the "correct" solution would be to set a "delete_on_destruct" flag in the handle itself. But I'd have to propagate that down several levels of abstraction.
Maybe later.
 
@Brian: no; that would be disastrous, roughly like the long since obsoleted overload keyword was disastrous. — Jonathan Leffler 1 min ago
 
What do you guys use for email? I'm looking for an outlook alternative for my "corporate" email.
 
5:46 AM
FFFF this shitty connection.
TIL
 
@Mysticial I often ask SO questions when I encounter special situations like that. It lead to many new insights.
 
@Mysticial I ran into that issue myself. Didn't find any "clean" solution.
 
It explains why I have so many questions.
 
I think I even asked here once.
 
Most of them are very embarrassing in hindsight.
 
5:47 AM
There is nothing embarrassing about not knowing something at some point in the past.
Not asking is far far worse.
 
wait
these are files?
like some are deleted afterwards and others are "kept"?
 
10
Q: What is the right way to find the average of two values `a` and `b` in C? (You can't just (a+b)/2 because it can lead to integer overflow)

bodacydoI recently learned that integer overflow is an undefined behavior in C (side question - is it also UB in C++?) Often in C programming you need to find the average of two values a and b. However doing (a+b)/2 can result in overflow and undefined behavior. So my question is - what is the right wa...

Getting the average... and look at those solutions!
 
I answered something similar for Java:
20
Q: Why in Java (high + low) / 2 is wrong but (high + low) >>> 1 is not?

JohnPristineI understand the >>> fixes the overflow: when adding two big positive longs you may endup with a negative number. Can someone explain how this bitwise shift magically fixes the overflow problem? And how it is different than >> ? My suspicious: I think it has to do with the fact that Java uses ...

Wow. Almost 2 years ago...
I've been on SO for that long already?
 
6:05 AM
@Mysticial During that period we've been through many highs and many lows.
 
yeah
 
        if(lhs.name < rhs.name) {
            return true;
        } else if(rhs.name < lhs.name) {
            return false;
        } else if(lhs.alias < rhs.alias) {
            return true;
        }
        return false;

        // vs.
        return lhs.name < rhs.name   ? true :
               rhs.name < lhs.name   ? false :
               lhs.alias < rhs.alias ? true : false;
reminded me of your issues @StackedCrooked :p
 
@Rapptz I have pattern for that.
 
@StackedCrooked The only low that @Mysticial experienced is when he clicked his green score notification thingy (or did he?).
 
@StackedCrooked Would you have been lost if I didn't provide the original? :p
 
6:09 AM
It's an operator< for a combined key, right?
if (lhs.name != rhs.name) return lhs.name < rhs.name;
else if (lhs.alias != rhs.alias) return lhs.alias < rhs.alias;
else return lhs.bla < rhs.bla;
 
yeah it's basically operator< on a pair of values.
It's how std::pair implements it
 
I often use std::tie now.
 
I didn't want to construct a temporary pair for every insert
 
Actually, I think I posted an SO question about this once.
 
std::tie-so-useful.
 
6:10 AM
I think it was Xeo
 
@Rapptz You mean that for std::tie?
 
@MarkGarcia or std::make_pair
they both do the same thing
 
Doesn't std::tie only construct a tuple of references?
 
2
Q: How to place objects that seem not be comparable in a C++ std::set?

StackedCrookedSuppose I want to put objects that identify a server into a stl set. Then I would have to make sure that I also implement operator< for these objects otherwise I would run into a compiler error: struct ServerID { std::string name; // name of the server int port; }; std::set<ServerID> server...

Somewhat related...
Johannes chimed in with std::string::compare.
 
@StackedCrooked Actually.
This is almost exactly what I'm doing.
name is std::string and alias is a char :p
So very related
 
6:20 AM
operator <(std::string, std::string) is like a lexicographical compare?
 
yes
 
user3010322
I fucking hate IT.
 
user3010322
I'm still at work, FFS.
 
I started working for my uncle recently. I'm pretty much a software monkey.
 
user3010322
I'm being asked to accomplish impossible tasks in short amounts of time.
 
user3010322
6:32 AM
By my development lead, no less.
 
user3010322
I've been trying to stall to buy myself time but today was "Get it done." With the trailing silence that adds the "Or else."
 
@ThePhD what time is it?
 
user3010322
Almost midnight.
 
looks like we're in the same timezone then
 
user3010322
I refuse to leave until it's done but I was sick today. And I feel myself getting worse, but I won't tell anyone that for fear of being leered at for missing even more time.
 
user3010322
6:37 AM
And I hate how everyone here is just "oh yeah, that should be easy to do. No problem. You can finish it today, right?"
 
user3010322
It's not just the Managers, or "PM"'s as they're called. It's the dev leads and other engineers. I don't know how to explain it to them, because even when I do it's like everything I say goes in one ear and out the other.
 
interesting way to start the day
went to the vending machine to get a sandwich
sandwich got stuck
 
user3010322
And it shot it in your face
 
the machine didn't charge me though
 
user3010322
right after shredding it into pieces
 
6:42 AM
I couldn't get the sandwich out so I asked for another
and in the end I got two sandwiches
for the price of one
it feels wrong and good at the same time
 
that's one honest machine you have
it's so hot here right now
I'm used to be freezing because of all the AC
 
Do you write any F# zneak?
 
> A 10-year girl in Afghanistan is in danger of being honor-killed by her family after being violently raped by a mullah in a local mosque after her Quran class. After the family openly talked about killing the girl, the mullah offered to marry her, claiming to the authorities that he thought the girl was 17 and that the sex was consensual.
people around those parts really need some reeducation
 
wtb value_ptr
;_;
 
I did a tiny bit of haskell, if that counts
 
user3010322
6:52 AM
@Rapptz Write one, scrub.
 
I'll pass
It's the one thing I never want to write
 
@zneak The F# room has been nice lurking lately if you are interested
 
@ScottW hi
 
@Rapptz colleague is trying to solve this equasion (ax + b) % c. Any idea on how to proceed?
 
it has an infinity of solutions
 
6:59 AM
yeah, he already figured that out
 

« first day (1377 days earlier)      last day (3563 days later) »