« first day (1620 days earlier)      last day (3310 days later) » 

4:00 AM
like... it says it right there
@LucDanton it feels like all the information you need is there at link time at least... don't really know enough about constexpr or templates to do anything though
 
Is this how it feels like to be 4 years behind C++11?
 
@Pris You don’t know the exact details of the library that will be loaded at link-time.
Load-time is typically at program startup.
I’ll show you an example.
 
auto function -> return type 	(2) 	(since C++11)
woo0o0ooo0o0o0ops
 
@DonLarynx you might also see that used to specify return types for lambdas
[]() -> return_type { }
 
4:15 AM
@Pris [x[3]](t, u) {return t + u}` modifies the value of x by reference at 3 *sizeof(x) bytes.
 
what
 
i'm just joshing you, just like i got joshed by fellow cs students earlier this evening
it was disturbing to say the least
 
@Pris So here and here are two implementations of the same library (see namespace lib). Notice how one has one more type than the other?
 
ASR
good morning all
 
Not sure if I've done myself (or the original asker) a favor with this :-/ :
-1
Q: C static keyword vs C++ private scope?

πάντα ῥεῖAs a sequel to this question: Best practice static C function or private C++ method Which is the most adequate C++ replacement for static void bar() { } appearing in a c module foo.c? A private function in a class foo class foo { void bar(); }; void foo::bar() { // ... } or as m...

 
4:20 AM
@LucDanton yeah
 
@Pris So in this combined program, how many types are we really using?
 
Is it possible to modify a const variable in a program without const_cast by use of pointer magic?
 
@Cinch No.
You are not allowed to modify const (sub)objects.
That you use const_cast or otherwise to do it is not a factor.
 
Hm.
 
@LucDanton Its kind of hard to tell whats going on. You compiled that program twice, once with libvanilla and once with libchocolate. The application linked against vanilla has a single plugin implementation, the application linked against chocolate has two
 
4:28 AM
@Pris No, it is compiled exactly once. There are three calls to g++, one for vanilla, one for chocolate, and one for the combined program (in that order).
Later I call it once while pointing the loader to vanilla, once to chocolate. There is no compiling going on.
During compilation -Lvanilla -lplugin does mean that we are checking against the vanilla implementation. However the final executable does not contain vanilla code!
You can poke & prod things with e.g. file a.out or ldd a.out to see what’s going on if you want.
ldd will show you that the binary can only be run if the loader fulfills a libplugin.so.
 
Okay. So the first time around you have LD_LIBRARY_PATH set to vanilla, so when you run a.out it loads vanilla as the plugin. The second run you change LD_LIBRARY_PATH to chocolate, so it loads chocolate as the plugin
 
Right. You can try LD_LIBRARY_PATH=vanilla/ ldd a.out to see that the loader notices the vanilla implementation.
 
In a sense our notional C++ program is represented by at least two binary pieces after compilation, a.out and libplugin.so. That second piece can be swapped by another with the same shape long after compilation however!
This is why you cannot ascribe a compile-time value to 'the number of types in use in my program'.
 
4:43 AM
You linked against the vanilla plugin initially when you compiled main.cpp. You're limited to the 'API' of vanilla. Like if you have a template class vector<>, when you compile an application, the type you instantiate that template with must be visible.
So even if you swap out the underlying plugin, you're still using just the interface types aren't you?
 
Then why do we see the message from impl2? What does 'use' mean for your purposes?
Have you considered the same program but done without libraries? Would that make a difference in the number of uses?
@Pris To be precise, the API (i.e. 'shape' that can be substituted for) is entirely defined by base and lib::plugin (I should really have made base part of lib, I didn’t pay attention sorry).
@Pris Does this program use only base? If I hide impl and impl2 in another source file and call std::unique_ptr<base> make_impl(); and std::unique_ptr<base> make_impl2(); factories, am I also using only base?
 
I'm not trying to count the total number of types in the program. I want to count the number of types instantiated in a specific class template. My understanding is that program has the types 'base', 'impl' and 'impl2', but you're only calling the unique_ptr template on base. So as far as unique_ptr cares, you've only instantiated it out for 'base'
Sorry if I'm being a dullard and missing something obv, I really appreciate all the trouble you're going through
 
std::unique_ptr is not the type of interest, impl and impl2 are. You can make them class templates if you care for it.
Does that make sense to you? I can amend the examples.
Or you can make them inherit from some foo<N>. Then vanilla could be using foo<0>, and chocolate both foo<0> and foo<1>. How many instantiations of foo would the combined program be using?
 
4:58 AM
The way I envision it, foo<0> or foo<0>,foo<1> don't make sense
Why would your implementation know about this template?
wait
 
The class template would be shared across the three fragments.
@Pris It works the same as it would if there were no libraries. The same principles hold.
 
I think I'm on the precipice of breaking out of stupidity here
 
Okay when you said you were trying to count instantiations, was it really across the whole program?
 
Good bacon-wrapped-french-fries night
 
5:03 AM
@LucDanton Yeah
 
I wanted to demonstrate that the notion of 'whole program' is treacherous. But perhaps you had something else in mind when you said 'program'.
A C++ program is made of pieces. Any one piece does not really know about the other pieces. It knows about the shapes, so to speak.
 
Can you even compiled templated functions into shared libraries?
 
Hence there are many things, such as the number of types or instantiations of a particular template, that you can’t know about at compile-time. Because the other pieces might not even have been compiled ye.
 
I think I can sort of understand this: Say you have a lib, libfoo that has a class template Foo<> which tries to count how many types instantiate it. You can't know at compile time because any number of libs may link to libfoo and use it for N number of types
 
@Cinch Shared libraries are not exotic. They are executables just the same.
 
5:06 AM
if you don't use templates in shared libraries, what do you use them for?
 
@Pris Right. And they each know how much they themselves instantiate.
 
Regardless, how can something like a templated lexical_cast work if you need to know types?
I thought templates are basically compile-time generics
 
@Cinch You can never instantiate on a type that doesn’t exist.
 
I was going to ask you why this isn't determined when everything is linked, but then your example with the plugin made me go 'oh yeahhhhh'
 
@LucDanton right.
 
5:08 AM
@Cinch So that works out the same, library or no library.
 
But if I were to compile my to_string to a library it would still work
 
Make sure you make the distinction between a template and its specializations.
std::vector is not std::vector<int>.
@Pris Now you could restrict your original problem to 'how many instantiations of foo are there, considering all the non-dynamically-linked pieces?'. The thing is, C++ as a language doesn’t make the distinction between library or non-library, much less what kind of library.
That means C++ the language is something like two levels removed from what you’re looking for.
 
I owe you a beer @LucDanton... ty for all the help
 
In case you ever stumble upon it, the C++ language abstract term for the 'pieces' of a program that we assemble together (regardless as to whether our C++ implementation does this in the form of non-libraries, static libraries or dynamic libraries) is 'translation unit' ('translation' being more or less the abstract term for linking), or TU for short.
In C++ implementations 'pieces' are typically object files. Some object files are suitable to be bundled up/assembled together to form (static or dynamic) libraries.
 
5:51 AM
if(s != std::exchange(previous, s))
Not sure if I should be glad std::exchange is coming in handy or upset that more side-effects are creeping in.
 
why not both
 
@Rapptz If I stick to 'traditional' then I can previous = std::move(s);, so that tilts the balance slightly perhaps?
I think I’ll stick with that and ditch the lispy version.
 
looks neat
 
@Rapptz What to call the option that controls the level of indentation? (e.g. 4 spaces per level in the example)
 
indent.
 
6:02 AM
level of indentation
 
What if I have an option that also controls how many levels to start with?
 
The Vim option is 'tabstop'. Kinda weird, no?
A tab stop on a typewriter is a location where the carriage movement is halted by mechanical gears. Tab stops are set manually, and pressing the tab key causes the carriage to go to the next tab stop. In text editors on a computer, the same concept is implemented simplistically with automatic, fixed tab stops. Modern word processors generalize this concept by offering tab stops that have an alignment attribute and cause the text to be automatically aligned at left, at right or center of the tab stop itself. Such tab stops are paragraph-specific properties and can be moved to a different location...
 
tabstop is something else
imo
 
@Rapptz Why are you using the bitwise thing for enums?
 
6:05 AM
> In text editors on a computer, the same concept is implemented simplistically with automatic, fixed tab stops.
Yeah, I feel this is relevant.
 
@Jefffrey Because they're flags?
 
@Rapptz I was curious about the origin of the option. Now that I know about it, I’m even more sure I’m not going to use it.
 
@Rapptz And you can't use regular enums for that?
 
that's how I usually make enum flags
what do you mean regular enums?
 
You honestly don't know what I mean by regular enums after I asked you why are you using the bitwise thingy?
 
6:08 AM
'Indent' seems like the more usual term, even though used like that it seems to be stretching the meaning of the word (when it’s intended as 'additional indent per level', no?).
 
@Jefffrey I'm quite curious.
It's a bit flag.
How would a non bit flag work?
How would you test that option X is turned on but not option Y?
 
Nothing, you are right.
 
@Rapptz I would be using unsigned.
 
It's not about being right, I'm just curious why it seemed odd.
I honestly don't know of another approach.
@LucDanton yeah you're right
mistake on my part :p
 
I forgot what bit flags were for a second.
 
6:24 AM
@orlp cache? Also could be CPU arch or compiler (version)
Also good morning
 
Simultaneously goodnight
 
6:51 AM
@πάνταῥεῖ 52, 60, 58 that's if I skip a meal before, very famine resistant! </troll>
 
user4330208
user image
4
 
Scott W are you good with bit-shifting math?
 
7:25 AM
What is this with shape bit shifters in the lounge lately
@Pris The precipice of an outbreak of stupidity ? ^)
@LaVloZ What do you mean? — πάντα ῥεῖ 2 hours ago
@πάνταῥεῖ He means you can shut up :)
 
7:58 AM
Okay, I got like 5 rectangles of data with different sizes and at different locations (images) that I need to combine, how can I do it in a general way so that the overlap is blended (averaged)? Anybody know what this is called?
 
Xeo
mornin
 
lol
 
@Mikhail I lost you at "(averaged)" that makes no sense
 
8:15 AM
I need to blend a bunch of images, how do I do it (also will need to do it in 4D, but I guess the same strategy...)\
What if their bits don't fit?
 
user1804599
Hello.
 
user1804599
@FatalSleep I only bitshift linguistics.
 
user1804599
8:40 AM
Your dog is a son of a bitch.
 
Does anyone know how bitmasks for for colors in images of varying bitdepths?
For example a 16-bit PNG image might have a 5-bit bitmask per pixel, e.g. 5-bits per Red, Green and Blue with 1-bit left over, e.g. X. How would I display each RGB component of a pixel in a 0-255 format?

I have a general idea --> 0-255 RGB = 255/RGB_BitMask * RGB
Is this the right way to go?
 
8:55 AM
Real programmers do it with masks and shifts.
 
@FatalSleep with 5 bits you'll get a channel value between 0 and 31. You can scale that to 0-255 or whatever else you want
 
Correct.
I'm just hoping that scaling it like this is correct.
 
After some annoying issues, I'm thinking make_shared isn't all its cracked up to be:
* can't use with private or protected constructors without ugly workarounds
* issue freeing memory if weak_ptrs are still hanging around
 
@FatalSleep Well, when you debug it, you will find out.
 
The only thing I see that's a decent benefit is faster/nicer memory allocation
Someone did a test and saw a factor of two improvement with make_shared. Whether or not thats a big deal to you depends on how often you're creating shared_ptrs.

http://tech-foo.blogspot.ca/2012/04/experimenting-with-c-stdmakeshared.html
There's also exception safety
 
9:15 AM
Free Home Version - IncrediBuild FreeDev is free for life on up to 8 cores. Use it at home, on your personal projects - at no cost
 
was about to bin for spam
 
lol
admittedly looks a bit like an ad
 
user1804599
 
@Pris interesting
 
@BartekBanachewicz for 30 days
at least id ont see the 'free for life' part
 
9:25 AM
isn't it an update or something
 
user1804599
With transducers you don't have to reimplement these algorithms for both arrays and observables.
 
user1804599
Which is even terrificer.
 
@райтфолд what geoloc lib is that
 
user1804599
directions calls Google's.
 
user1804599
It's a shame subscribe isn't called forEach.
 
user1804599
9:31 AM
  Rx
wow
      such combinator
 many observable
 
10:14 AM
Teehee. From a question:
> for (const auto& v : kids) { // v is of type ptree::value_type
How not to use auto
@Mikhail perhaps you should say what it means to blend. You want to "blend" rectangles...
 
@sehe Why not? Just curious
 
...
 
Oh, sure, now I get it. Thanks!
 
user1804599
retain(*unit); // TODO: Fix memory leak.
 
user1804599
I should make Unit a singleton.
 
user1804599
10:21 AM
And Boolean a twoton.
 
Wouldn't that be doubleton?
 
user1804599
Right!
 
@sehe That's... ugh.
 
@Griwes I don't get it, what's ugh about it?
 
@AndyProwl he's already specifying the type
in the comment
why use auto if you specify the type anyway
 
10:31 AM
@Rapptz Oh, that. Thank you
 
@Cinch any chance you're there?
@Cinch wanted to discuss the Last Question
 
@sehe s/Teehee/Sehe/
 
10:55 AM
Hi.
Any thoughts on biicode?
 
looks like a good idea
haven't tried yet
 
@tomzooi I think I understood it now. (A bit of messy code can obscure a lot of simplicity!). Updated the answer with a 14-line version. Deleting more code I got the JSON output to pretty print as well :) — sehe 7 secs ago
TDWTF:
> In the real world, if a student thinks the teacher is wrong, he doesn’t get to change his grade. The surgical resident cuts where the surgeon says and not the other way around. The general doesn’t discuss strategy with the privates. If you join a union, and as the new guy demand to have equal say on policy with the union bosses, you’ll be bunking with Jimmy Hoffa.
> Experience speaks with exclamation points. Inexperience speaks with question marks.
I find that last sentence to be completely reversed.
 
11:14 AM
Hi.
 
Lo.
 
Capitalization fail.
 
user1804599
dat plane crash
 
Hmm. Missed something.
 
user1804599
11:20 AM
The SOS.
 
user1804599
I need inline assembly.
 
our most experienced dev completely smashed the build this morning
spent the last two hours installing windows updates and generally doing all sorts of odd shit
 
user1804599
What does [] (int x, ...) { } mean?
 
You're not the most experienced dev?
@райтфолд A lambda with variadic arguments?
 
user1804599
11:23 AM
@R.MartinhoFernandes Is it C-style variadic or a variadic template?
 
user1804599
clang errors when I use va_start inside it. It says I used va_start in a non-variadic function.
 
user1804599
Even when I omit the comma.
 
@R.MartinhoFernandes A crime against knowledge, but my boss insists.
 
user1804599
Döner–Kruger
 
I'd have a Doner now
 
user1804599
11:35 AM
hahahaha
 
user1804599
int f(...) {
    [] (int x, ...) { va_list xs; va_start(xs, x); va_end(xs); };
    return 0;
}
 
user1804599
This crashes clang.
 
user1804599
Making f not variadic gives an compile-time error.
 
did Tomalak rage quit again?
 
huh? Why?
 
11:37 AM
12 hours ago, by Lightness Races in Orbit
that was quick
Last message.
Doesn't look like a ragequit.
 
@R.MartinhoFernandes chinese food coma it seems
 
Looks like he ragewentforfood
 
good
the US needs some anti-patriotism in their country
 
11:45 AM
@райтфолд Can't you use a variadic generic lambda?
 
hi. if i asked a very small thing about function template syntax are you going to address me to SO for such a little thing?
 
The fuck is wrong with that Mikhail Vanin dude?
Also, FFS FUCK YOU ALL JOURNALISTS.
If you write "Via the AFP" and make "AFP" a link DON'T FUCKING MAKE THAT LINK GO TO YAHOO NEWS INSTEAD OF THE AFP.
 
The level of stupid of that is over 9000.
 
@LightnessRacesinOrbit the chinese food was good?
 
11:48 AM
@Mgetz ahahaha
@Mgetz you know what, it was. not the best ever, but acceptable
 
sadly often the case, at some point I need to let someone who speaks mandarin order
 
And of course Yahoo News also claims to have gotten the story from the AFP, but no link whatsoever.
Now I have to grep the AFP site myself.
 
user1804599
@AndyProwl no
 
user1804599
I need C variadic here.
 
user1804599
It's easier to work with in this case because of LLVM.
 
11:49 AM
Looks like a compiler bug
 
And the AFP site doesn't appear to have the story.
haha
 
@R.MartinhoFernandes who?
 
Explains why they didn't link to it.
 
"Which compiler is correct here?" Certainly not the one that ICEs. — Griwes 8 secs ago
 
> Never leave your
vehicle with keys in
the ignition if
still inside the child (or
beast)
car manuals in czech are kinda scary
 
user1804599
11:50 AM
@Griwes read more closely.
 
maybe something was lost in translation
 
Ah, found it.
 
user1804599
The ICE is interesting and probably related, but not the same thing.
 
@Puppy Some Russian ambassador.
 
@BartekBanachewicz What's the original text?
 
11:51 AM
@райтфолд The comment is a joke, in case you didn't notice.
 
user1804599
OK.
 
user1804599
Poe's law.
 
And of course it doesn't sound like a threat if you remove the surrounding text that says it is a threat.
Ten minutes in and I remembered why I stopped bothering with the news for weeks.
 
user1804599
<pre>...</pre> in a blockquote looks ugly on Stack Overflow.
 
user1804599
11:53 AM
:(
 
> Nikdy neopouštìjte své
vozidlo s klíèem ve
startovacím spínaèi, pokud
zùstává uvnitø dítì (nebo
zvíøe)
clipboard fail
 
Yeah, translation fail
 
I suppose it was meant to be "an animal"
 
"if a child (or animal) is still inside"
 
Still applies to beasts, though.
 
11:55 AM
anyway, yeah lol the only car manual pdf for my car I was able to find is in Czech
 
> We have made clear that NATO's ballistic missile defense is not directed at Russia or any country, but is meant to defend against missile threats.
And that immediately makes it the target of missile threats. It's just a fact, not a threat.
:<
 
is there any chat for C++ noobs? :)
 
@LisaAnn a) did you google first b) did you search stack overflow first
 
@BartekBanachewicz lol, what?
 

« first day (1620 days earlier)      last day (3310 days later) »