« first day (1399 days earlier)      last day (3542 days later) » 

12:01 AM
my tile engine is complete. I need to produce more tears.
 
Watch this instead
 
this video has ruined the original track for me
 
And I'm going to eat the second one too
 
12:08 AM
@Rapptz maybe one day ill be able to understand it
 
@Borgleader it's mostly gibberish
 
^^ fail
 
If you watch Kiniro Mosaic subbed you'd see the scenes in question
 
is that the historically themed anime?
 
nah, it's a Slice of Life.
 
12:11 AM
ah, is it done on purpose that her jacket looks like britain's flag?
 
yeah she's supposedly british
Kiniro Mosaic is on its second season actually.
 
12:32 AM
 
@Jefffrey HxH amiright?
>.< failimage
yep :D
 
@Borgleader yup
 
> Thank you for reviewing 20 low quality posts today; come back in 23 hours to continue reviewing.
bullshit
 
@Mysticial Haha, what is this, League of Legend's tribunal?
 
they should really expand it from 20
btw @Mysticial you're right, I got half the bounty.
I don't know how it works though
4
A: C++ templates that accept only certain types

RapptzThis typically is unwarranted in C++, as other answers here have noted. In C++ we tend to define generic types based on other constraints other than "inherits from this class". If you really wanted to do that, it's quite easy to do in C++11 and <type_traits>: #include <type_traits> template<typ...

 
12:39 AM
@Rapptz "poorly"?
 
I can't see who got the other half
or why I got chosen
 
The other half is lost.
You got chosen because you're the new answer with enough votes.
 
ah
poor 50 rep.
RIP
so the guy who put the bounty doesn't get half his bounty rep back?
 
correct
 
sucks
 
12:42 AM
The guy who posted the -8 bounty got his rep back after the question got nuked.
The person who answered it lost the bounty.
 
that sucks even more
 
So the game is:
Post the worst question you can possibly post, but keep it open long enough to bounty it.
Then nuke the question and get your rep back. lol
Which doubles as a, "haha fuck you" to all the answerers.
 
on an unrelated note, the new Steam is so nice and fast
looks good too
 
looks the same to me =/
 
and you supposedly a good score on the colour test
 
12:44 AM
 
tsk tsk.
 
holy mother of badassery
@Rapptz maybe mine didnt update!
:(
 
@Mysticial My name is Jerry Coffin and I did not approve this message game.
 
...new steam?
also, steam and color? :p
 
yeah there's a new steam update
 
12:45 AM
screenshot or it didnt happen
 
the browser is like 50x faster
everything about it is good so far
 
oh, you have to opt-in to the beta
 
do I have to opt in to a steam beta or something? cause mine did nothing.
 
new Steam icon
avatars are boxed now
 
ok so, its flatter, less rounded edges, no more diagonal stripes at the top
and do i see a blue tint?
 
12:47 AM
yup
chat has different hues
 
noyce
 
and browser is a lot faster now
 
oh damn the browser is quick
 
it loads instantly
 
focus color in general seems to have gone form orange/yellow to blue
 
12:48 AM
did they switch to chrome? xD
 
iunno but I like it
no longer will it take me a minute to load pages :v
 
still no tabs/10 :p
 
also the notification changed
it's now flatter/boxed instead of rounded corners
 
the scroll bar in the browser is ugly and doesnt fit
 
@Rapptz they metro-ed the UI :P
dare I say... Win8-ified it ;)
 
12:51 AM
lol
 
indeed. they even killed the aero shadow didnt they
 
shadow is still there
 
@melak47 no its still there
 
@Rapptz Another ugly green on black that makes my binning trigger itch.
 
it looks good
 
12:52 AM
@Borgleader less intense than regular windows though
 
@Rapptz Looks like packaging on a 2001 X-box game.
 
@JerryCoffin it's green on gray :p
 
@JerryCoffin Different hues of green.
 
@Rapptz Okay--not even a good imitation of a 2001 Xbox game!
 
12:55 AM
Is there a way to disable locales in iostreams?
I ask cause someone mentioned it yesterday but it seemed wrong to me
 
@Rapptz Disable locales? Not sure exactly what that would even mean. For example, when you do an extract, it uses the locale to determine what's white space. If it didn't have a locale, I'm not sure what you'd expect it to do.
 
in my noob opinion, it only makes sense to force a locale, but not work without one
 
I found the answer I was referring to.
 
Without the locale, what you have left is pretty much just the stream buffer.
 
34
Q: How to get IOStream to perform better?

Matthieu M.Most previously C-users prefer to use the printf / scanf family of functions even in C++. Although I admit that I find the interface way better (especially POSIX-like format and localization), it seems that an overwhelming concern is performance. Taking at look at his question: How can I sp...

it seems the most you can do is set it to the C locale
which (I think?) is the default one?
 
1:04 AM
@Rapptz Yes, it is.
 
a quick test on fscanf vs std::ifstream doesn't really make std::ifstream 2-3x slower on my end
but then again, that answer was using ancient gcc..
 
try msvc
 
you try it
 
Is a default constructed std::shared_ptr guaranteed to be nullptr?
 
I don't have msvc handy on me
 
1:10 AM
paste me the code you used
 
cppref doesn't say
 
it's in the answer of the question
 
@anthropomorphic it's guaranteed to be empty
 
@anthropomorphic yes
 
@melak47 yes, but that doesn't mean it's guaranteed to be nullptr
 
1:12 AM
@anthropomorphic so? :)
 
@Rapptz thanks
 
operator bool tells you if there is a managed object or not. don't rely on .get() == nullptr :p
 
@melak47 so I don't want to explicitly assign nullptr to everything if it's already guaranteed to be that
 
@Rapptz hah, wont compile because of <sys/time.h>
 
sucks
replace it with std::chrono!
 
1:13 AM
@melak47 oh good point thanks
you just saved me some ugly code
 
nah, ill use nonius tomorrow
 
there are explicit comparison operators
i.e. shared_ptr == nullptr
 
@ScottW how old are you?
 
he's 58
 
58, really O.O
 
1:14 AM
minus 30
 
:p
 
@ScottW are you < 3 * her age?
 
pfft whats 9 years :P
 
@anthropomorphic that formula seems odd
 
1:15 AM
@ScottW the 19yr old what?
 
You're fine.
 
Jeffrey is into that kind of stuff.
 
@ScottW I think you should go for it. As long as she likes you and you like her, age difference is not a big deal.
@ScottW I don't think you should be concerned by what people think
unless they are close to you.
If your mother says no, don't do it.
 
@ScottW make sure she doesn't have ebola, aids or feminism
 
user3010322
Guize
 
user3010322
1:19 AM
Megabits per second is usually shown as
 
user3010322
Mbits/s ?
 
also Mb/s
 
@ThePhD or just Mb/s
 
Mb/s
 
user3010322
Ah, that's the better way.
 
user3010322
1:19 AM
Got it.
 
how do you express mebibytes?
 
mibibytes?
 
MiB apparently
 
Hellabyte
Hebibyte
 
grammar does matter
 
1:23 AM
@ScottW I honestly dont know what I would do in your situation, but uh... maybe you could ask them about it?
 
@ScottW I dated a 27 year old when I was 18 (although I'm a guy). Meh.
 
Is it possible to default a method argument to a non-static member of the class?
 
those were fun times
 
> Meh.
 
Klass::func(T x = member); where member is a non-static T in Klass
 
user3010322
1:25 AM
Nope.
 
user3010322
It's not.
 
user3010322
You can do the same thing by writing 2 overloads.
 
user3010322
TBH, I wish that was a thing though.
 
@ThePhD this
 
user3010322
Would be fuckin' sweet.
 
1:26 AM
@ThePhD oh right, thanks, I didn't think of two overloads
 
never had to do such a thing
inb4 I haven't lived
I'm currently farting too much
 
@Jefffrey Hai Puppy :P
 
it has been 25 minutes of non-stop farting
 
imagine your potential employer was doing the background check & read this ...
 
WON'T HAPPEN AGAIN BOSS
 
1:34 AM
@chmod711telkitty if they care about something like that, you probably don't want to work there.
 
Is there a way to typedef a template (without fixing it to a specific type)?
like template <class T> typedef x_ptr<T> std::shared_ptr<x<T>>
 
user3010322
template <typename T>
using x_ptr = std::shared_ptr<x<T>>;
 
@ThePhD you are my savior
 
user3010322
(Requires a compiler that does not suck dick)
 
1:39 AM
Does it work on GCC and / or Clang?
Also, if I do that in a namespace, will it need to be namespace qualified from elsewhere?
 
yes and yes.
 
user3010322
If the question is "does it work on GCC/CLang"... the answer is almost always Yes.
 
Also, is that standard c++ or an extension?
 
user3010322
The only compiler you need to tiptoe around is VC++ (in Visual Studio).
 
user3010322
That's standard C++.
 
user3010322
 
VC++ has been getting on my nerves lately.
 
user3010322
It always will.
 
user3010322
For the next 3 years at least.
 
They have an extension to disable <ciso646>.
So you can't use and and or instead of && and ||
 
I've never actually used those
but they're okay.
 
1:43 AM
@Rapptz most people recommend against it, but I like them a lot so I say "screw you" to all those people.
 
I'd only really use it as a replacement for and, or, and not.
 
I also wish C++ had unless
@Rapptz same here. It's more expressive that way.
 
Good morning.
@anthropomorphic ||?
 
Actually, now that I think of it, unless could be implemented as a macro.
@MarkGarcia ?
 
What should unless do anyway?
 
1:48 AM
The exact opposite of if
as in Ruby
unless (false) { /*executes this */ }
unless (true) { /* does not execute this */ }
#define unless(c) if(!c)
 
user3010322
unless(false || true)
 
user3010322
->
 
user3010322
if (!false || true)
 
user3010322
Wrap that shit in parenthesis.
 
yeah, your macro needs more parens
 
1:53 AM
wait, what?
 
user3010322
Look carefully at how I expanded your macro
 
user3010322
see exactly what's wrong with it.
 
unless(foo && bar)
 
@ThePhD I still don't see it. You're going to have to spell it out for me.
Oh! I see.
 
Macros are evil.
 
user3010322
1:56 AM
s/evil/a dangerous tool
 
#define unless(e) if(!(e))
This is why TDD is a thing.
Of course, if I was writing tests for that I would probably never have thought to pass false || true
 
macros are evil.
 
TDD is no excuse for carelessness.
 
user3010322
There's still things they can do that regular code can't.
 
You can also carelessly write tests.
 
user3010322
1:59 AM
So I can't say they're completely evil, because they do serve a currently irreplaceable purpose (with just the core compiler).
 
their code generation properties are kind of meh
 
user3010322
If you add something like cog on top of your compiler, though, then you're all set.
 
I only use macros for very repetitive constructs in implementations.
If there's no other better option.
 
When I write the skeleton for a test and the report complains about an empty test case, I shove in a BOOST_CHECK( true ); to shut it up.
 
I write a macro and then run the file through g++ -E and copy paste it
I don't like my code screaming at me
 
2:01 AM
@Rapptz Haha.
 
@ThePhD what's cog?
 
user3010322
Code generation tool that can be run just before your compiler.
 
user3010322
You write your meta-code in python in C++ comments.
 
user3010322
So you literally don't have to add any files, you just have a special comment that gets preprocessed by cog.
 
That's cool. Is it widely used?
 
user3010322
2:06 AM
Not a clue.
 
I've used it before, but that was a few years ago now
 
C# is the complete opposite of C++ when it comes to (undefined) behavior.
Too defined behavior.
 
I wonder how printf parses stuff like printf("%+005d", 10);
it does print what I expect..
+0010
 
@MarkGarcia that's totally insane in my opinion.
 
@AlexM. It seems I was already alseep by then.
Your story was so powerful that it put me asleep even before I heard it.
That's quite a feat.
But now I can't sleep anymore. Aaarg.
 
2:27 AM
@Rapptz A finite state machine to parse the format string and store the formatting information, and finally code to do conversion based on it. Back in the MS-DOS days, Microsoft's implementation actually had a very nicely coded state machine; last time I looked it had apparently been replaced with code that somebody must have liked, but it didn't look nearly as clean to me.
 
I just looked at libc's implementation
It is a monstrosity.
 
@Rapptz of printf?
 
yes
 
ew :p
 
2:32 AM
@Rapptz I wonder how it compares to MSVC's refactored CRT implementation.
 
@MarkGarcia Last time I glanced at them, I couldn't stand to look long enough to decide which was really worse.
 
Why is <functional> <functional> and not <function>? All the other headers are nouns.
 
user457812
Because gophers
 
<numeric>
 
@LucDanton I've never used that one. I didn't know it existed.
 
2:47 AM
@anthropomorphic Your loss--it has some pretty cool stuff.
 
std::accumulate :D
 
@melak47 do you find that useful? I can't think of any time I've needed to do something like that.
 
It’s a fundamental operation on sequences. Also there’s std::inner_product which is a zip + fold, with no intermediate storage.
 
3:17 AM
20
Q: String formatting with braces

ja72I want to output a formatted number inside braces (example {$100.00}) using a string.Format(fmt, x) statement with x=100. { var x = 100M; // works fine without a format specifier string.Format("{{{0}}}", x); // "{100.00}" // fails with a format specifier string.Format("{...

this is the problem with escaping }!
 
3:54 AM
@CatPlusPlus nice
 
You ARE getting older, though.
4
 
user3010322
4:12 AM
@Rapptz :D
 
user3010322
@Rapptz How does your code handle "{{{0}" ?
 
{stuff
{{ {0}
 
user3010322
So then you'd need to do {{{0}} to make it give {stuff} ?
 
yea
 
4:29 AM
@Rapptz why can't {{0}} == {stuff}?
 
because escaping } is for pansies
I'm working on printf syntax for fun
 
4:48 AM
Cinnamon Rolls are delicious
 
5:30 AM
How come building static libs for Boost doesn’t enable -fpic/-fPIC by default? That doesn’t seem sane or useful.
 
frozen hot chocolate? you mean ice chocolate...
 
@LucDanton -fpic is for shared libraries
 
No, it’s for position-independent code.
 
I know
But it's used when building shared libraries, not static
 
So, what happens if I build a shared library using code from a static library built without -fpic?
 
5:36 AM
I'm pretty sure it only works on specific archs anyway
@LucDanton I'm not sure.
 
Isn’t that the point of a configuration system?
@Rapptz It was rhetorical, that doesn’t work on amd64.
 
@LucDanton According to GCC -fPIC only matters on m68k, PowerPC, or SPARC.
tbh everything I'm reading pretty much says to only use -fPIC for shared libraries
 
Right. So when you use code from static libraries in those…
 
imma test this out
sec
 
$ cat wat.cpp
#include <ctime>

std::time_t what_the_fuck() { return std::time(0); }
$ cat areusrs.cpp
#include <ctime>

std::time_t what_the_fuck();

std::time_t are_you_new_to_this() { return what_the_fuck(); }
$ g++-trunk -pedantic -c wat.cpp
$ g++-trunk -pedantic -fpic -c areusrs.cpp
$ g++-trunk -pedantic -shared wat.o areusrs.o
/usr/bin/ld: wat.o: relocation R_X86_64_PC32 against undefined symbol `time@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
@Rapptz Here you go.
 
5:49 AM
I don't get an error but I did it differently I guess
 
Stupid sanity check: amd64?
 
yes
I made a static library named libadd.a
and a shared library named libaverage.so that depends on the static library libadd.a (which wasn't built with -fPIC)
 
What do the relocation entries look like for the non-PIC one?
$ readelf -r wat.o

Relocation section '.rela.text' at offset 0x530 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
00000000000a  000900000002 R_X86_64_PC32     0000000000000000 time - 4

Relocation section '.rela.eh_frame' at offset 0x548 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000020  000200000002 R_X86_64_PC32     0000000000000000 .text + 0
 
Oh, I'm on Windows
i.e. that didn't work
 
Ya no elves there.
 
5:53 AM
$ readelf.exe -r add.o
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
 
I don’t know how that goes in PE-land.
 
interesting to know though
 
Wow, massive API change in Boost.Coroutine.
@Rapptz In my case position-dependent code has relocations of the form R_X86_64_PC32 while the position-independent has R_X86_64_PLT. The former seems unusable without a symbol to link.
The original error is in fact fairly readable.
 
Yeah it is
 
Up to now I always compiled both static and shared versions of Boost but disk space is somewhat scarce now. So I said why not just keep one.
 
6:02 AM
I never build shared libraries
oh..
for some reason my libstdc++ doesn't support %n$
this doesn't work on my machine
it prints %2$d 10 20
 
Sadly I can find many references of people wanting to build Boost with -fpic/-fPIC, but no rationale as to why it’s that way in the first place.
 
well this is strange
 
@Rapptz I doubt that libstdc++ implements printf, if that’s what you’re using.
So you may very well be using a different printf.
 
er yeah
I'm guessing this might be a Windows CRT issue
kinda bumming me out
 
Come to the beautiful land of the elves!
 
6:13 AM
I have to use printf_p
I actually use Debian but I'm on Windows atm.
error: 'printf_p' was not declared in this scope
this is not working out very well
I give up
(I know why it doesn't work but I'm just frustrated)
Oh it's not printf_p, it's _printf_p
I see now. I guess I didn't know exactly why.
Still doesn't work. I might as well just boot to Debian.
It's less painful that way
 
6:27 AM
When I use LTO on my windows machine in VS everything works magically, but when I try using LTO in GCC and gentoo I get buggy code...Does gcc suck?
I think Intel did this with linuxdna.com but why the bugs?
Maybe when Clang starts working we can see LTO + Linux kernel
 
Which version of GCC and Gold? LTO was new and somewhat experimental not too long ago.
It can still fail to compile these days, too.
 
4.9.1, don't know about gold. I'm also talking about using LTO for core things like the kernel
 
Run ld --version.
> An uncaught exception inside a symmetric_coroutine<>::call_type's coroutine-function will call std::terminate().
That’s steep.
@Mikhail No Gold, no LTO. I doubt that’s changed.
 
6:59 AM
Hm.
No sane way of getting the type of a tuple based on a run-time index.
 

« first day (1399 days earlier)      last day (3542 days later) »