« first day (1356 days earlier)      last day (3575 days later) » 

12:00 AM
I wish someone said that to me... wait... installs chrome extension
 
user3010322
@Rapptz Damn.
 
@StackedCrooked wow
 
I wonder if he wrote a program to generate the code :)
 
I can't say my code is much better. Example: github.com/Mysticial/DigitViewer/blob/master/…
Though that example is among the worst ones. Most of them aren't that bad.
 
wow, that's a huge macro
do you distrust inlining that much?
 
12:08 AM
Yeah. If I were to rewrite it today, I'd do a force inline function.
 
> The factor "10.00000002" is a multiplicative purturbance to correct for roundoff error. There is no paper proof that this value works. Instead, it was verified to work by brute-forcing all possible inputs. There are only 10 billion combinations: (0 - 9,999,999,999)
 
your entire FileIO thing can be replaced with Boost.Filesystem
 
Nice :)
 
@Rapptz The code used to be 100% C.
 
12:11 AM
you can make Boost.FS non-throwing
 
My only critique is the 4 lines of slashes at the bottom. Also the only part I understand.
 
@StackedCrooked That's just my way of splitting up files into sections. This file only has one section.
 
@Mysticial Yeah I can see that. It's really butt ugly.
 
> The performance gain of this madness over the straight-foward division code is only about 1.5 - 3x depending on the architecture.
Oh dang.
 
uint64_t xgetbv(unsigned int index){
    uint32_t eax, edx;
    __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
    return ((uint64_t)edx << 32) | eax;
}
 
12:13 AM
@Rapptz At least they are exactly 80 characters long.
 
how do you get this to work in GCC-land?
that seems like a mix of extended ASM and the __asm__ declarative from VC++
 
@Rapptz It just does. That inline asm macros is specially for GCC.
 
really?
Well I know VC++ uses __asm__{} blocks
didn't know GCC had __asm__
btw shouldn't you declare these functions inline?
for the linker
if two files include this you get ODR violation
 
@Rapptz That's a bug. It probably only used once which is why I never caught it.
 
@Mysticial Is it common to implement move constructor for exceptions? I also think the =default should be sufficient.
 
12:18 AM
Don't bother making pull request though. That entire project on github is just a past snapshot of my local versions which are more updated.
Now that I think about it, if I were to rewrite that macro today, I'd probably use some amount of macros so that it'll be generalizable to larger vector sizes. The macro as it is right now is locked to 128-bit SSE.
Going to larger vector sizes will require a completely different approach.
 
@Mysticial does 256-bit SSE even exist?
 
@Borgleader AVX. Just a different name.
But my base-conversion subroutine stopped becoming a bottleneck after I wrote that macro. So I haven't bothered to upgrade it to AVX or AVX2.
 
@Mysticial Did you take a long time testing and debugging this code until it worked?
 
Now it's I/O bound rather than CPU bound.
 
It's harder to pirate this than buy it
I'm just gonna buy this disc again ._.
 
12:21 AM
@StackedCrooked ~5 hours IIRC. One really long afternoon.
 
@Rapptz what is?
 
Paper Mario: Thousand Year Door
I mean, aside from emulating it on my PC
 
5 hours to get a working version. Probably another day before it was fully optimized and unrolled as it is now.
 
well you need a modded console otherwise
 
Not really
I have an old Wii and a GameCube
I can just buy the disc
 
12:22 AM
do pirated games just run on gamecubes?
 
@LightnessRacesinOrbit ^
 
I have a homebrew Wii but I can't seem to find definite info on how to load an ISO from a USB
 
is that a dacia
 
Paper Mario Thousand Year Door
$59.99 used
;_;
 
hey PS3s are pretty cheap
 
@Mysticial does the register keyword still have meaning when using intrinsics?
 
can web sockets be used so far as to make online multiplayer games on the browser work?
 
also I could get the 12GB PS3 for $200
 
register keyword is deprecated
 
and just use my laptop's 500GB HDD on it
since I'm switching to an SSD
 
12:26 AM
Don't even consider anything but SSD.
 
@StackedCrooked Not at all. It's more as a visual indicator for myself when I'm writing the code. There are some things that I expect the compiler to put in register and others that I don't. And I usually mark them as such.
 
Ah, it's a form of self-documenting code? :)
 
Yeah.
 
I think 95% of C++ programmers have been in the situation where they wanted to define a method named "register" and cursed.
 
aha
Basically, I expect nearly all stack variables to be in register. Anything coming in from memory is probably gonna be directly accessed with no register required.
And quite often, I'll unroll something enough times to fill up all the registers by variable count. Spilling a tiny bit is okay.
If I manage to use fewer variables than the ISA has, I can almost guarantee that the compiler won't do anything stupid.
 
12:32 AM
What do you mean with spilling?
Use more variables than there are registers?
 
@StackedCrooked Running of registers and forcing data into the stack.
 
well
at least you didn't use auto :v
 
@StackedCrooked funny, I've never named a method "register" in any of my programs, regardless of the language :O
 
If I use more variables than registers, the compiler may or may not be able to coalesce them. But it almost never "creates" more in a way that will spill.
 
@AlexM. You are the 5% :P
 
12:34 AM
Sometimes I wish it would be illegal to be smart like @Mysticial so that I wouldn't feel so dumb :(
:P
 
lolwut
 
@Borgleader To reassure you, the talk about registers does not require extraordinary intelligence. It's just foreign.
I never work at this level, but I want to have better understanding.
My main motivation for learning about low level stuff is to be able to convince my colleague how foolish his little micro-optimizations are.
 
maybe Mysticial is going to win the nobel prize once
if he does
I PREDICTED IT
GOT IT?
 
@StackedCrooked Just make a remark about how his love for micro optimizations probably comes from his habit of playing with little things IYKWIM
 
12:38 AM
@AlexM. Duly noted.
@Borgleader His micro-optimizations mostly involve writing crappy code.
 
@StackedCrooked Indeed it is. The "unoptimized" version of that ugly macro is this:
The shortest way is to use std::to_string().
 
One of his optimizations was if (a != b) a = b; // a and b are long integers.
You now, better save the cost of overwriting an integer!
 
Wait
 
@StackedCrooked When did I do that?
 
That macro is to convert an integer to a string?
 
12:42 AM
@Mysticial I'm not talking about you, silly.
 
@Rapptz Yeah. There's two versions of it. One converts to an ascii string. The other converts it to a char array with each character having values 0 - 9.
 
@Mysticial Your methods delivered a world record. I'm not gonna critique that.
 
geez man
 
@StackedCrooked The only case I can imagine where that would be an advantage is that the statement is false most of the time and writing will pollute the cacheline forcing the CPU to write it back to memory.
 
Is sprintf slow or something?
 
12:44 AM
1
Q: Understanding `getArgs`

Kevin MeredithI expect the following GetArgs.hs to print out the arguments passed into it. import System.Environment main = do args <- getArgs print args But, after loading it in ghci, I get the following error: ghci> main 3 4 3 <interactive>:39:1: Couldn't match expected type `a0 -> a1 -> a2 ->

 
@Mysticial Ah. That's interesting.
 
@Rapptz I benchmarked against some built-in function a long time ago. And even my straight-forward division code was a lot faster.
 
I tried looking up how GCC implements to_string but couldn't find the source of their internal function
 
I think part of the reason what there there's no parsing or format specifiers needed.
 
cppreference says to_string uses sprintf but from what I saw it doesn't
 
12:46 AM
@Rapptz The hard-coded all possible inputs for to_string, like the intro-to-programming guy :P
 
it uses some built-in function or something
 
The other part is that my large macro does two 64-bit integer conversions at once.
 
or was that std::stoi, I forget
 
It takes two 64-bit integers (aligned in memory) and writes 38 bytes to an (unaligned) char array.
 
Oh it uses vsnprintf
02708   inline string
02709   to_string(int __val)
02710   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int),
02711                        "%d", __val); }
idk what __to_xstring does
I couldn't find it
if I had to guess it'd be choosing against std::wstring vs std::string
 
12:50 AM
8
Q: vector vs map performance confusion

Cechneredit: I am specifically comparing std::vector's linear search operations to the std::map binary search operations because that is what Herb's claim seemed to relate to. I know that using a binary search will move the performance from O(N) to O(log N) but that would not be testing Herb's claim Bj...

you would think they would understand the dynamics of the whole thing before attempting to test what herb said
 
It's been a few years since I've wrote that macro. Back then it was an advantage. I'd have to do another benchmark now to see if it still is fastest. But I don't expect two calls to `to_string()' will be faster than a single call to my macro. Especially after you factor in all the parsing and memory allocation overhead.
 
well the requirements are different
 
Those calls are used to convert the pi digits from binary to decimal?
 
std::sto* and std::to_string have error checking
 
12:53 AM
Exactly. Mine has a very specific purpose.
 
You could write a switch of all uint32_t values to convert them to string :P (That might cause cache misses in the instruction cache.)
 
@StackedCrooked Yeah. The first part of the conversion converts the digits into 32 or 64-bit integers with 9 or 19 digits per word. Then this macro is used to convert it to a char array.
The compression format that I use does 19 digits per 64-bit word. So the macro is needed there as well.
The straight-forward division version was actually CPU-bound when streaming over disk.
 
@Mysticial Nice.
@Mysticial And you need all the intrinsics for that. The standard solutions like bitmask/bitshifts etc won't cut it?
I have never used intrinsics. So I probably am asking stupid question here :P
 
@StackedCrooked The conversion involves repeated divisions. A single division is pretty bad to begin with it.
The macro uses an algorithm that "cheats" by replacing integer divisions with multiplication by a floating-point reciprocal.
And then massively vectorizing it to overcome all the added overhead.
Especially with the purtubations needed to make things round the correct way.
 
@Mysticial I've seen GCC do that when divisor is known at compile-time.
 
1:01 AM
Good morning.
 
@StackedCrooked Yep. It even does that for the repeated division version of the macro. But apparently my SSE4.1 version still beats it 1.5 - 3x.
 
How do const references complicate deduction of template parameters? — Rapptz 1 min ago
I feel like the OP is wrong here.
 
@Rapptz he is obviously clueless
 
@Rapptz That's statistically probable
 
1:18 AM
0
Q: What is an Array? (C++)

MitarashiFoxThis is a very simply answered question I presume, however I have reached a point in a book that I am reading where arrays are used. The book doesn't have a great definition or explanation of them, so can someone explain to me what it is? My understanding of it is that is an int (or item that can...

 
> My understanding of it is that is an int (or item that can be treated as an int) with more than one value
 
thanks for the dupe hammer
 
That gold badge power.
 
I was actually looking for it but couldn't find it :c
So I wrote a reason
 
> P.S If you haven't guessed already, I'm not a very advanced programmer. :|
:|
 
1:20 AM
:|
 
array |əˈreɪ|
noun
1 an impressive display or range of a particular type of thing: there is a vast array of literature on the topic | a bewildering array of choices.
2 an ordered arrangement, in particular:
• an arrangement of troops.
• Mathematics an arrangement of quantities or symbols in rows and columns; a matrix.
• Computing an indexed set of related elements.
3 [ mass noun ] literary elaborate or beautiful clothing: he was clothed in fine array.
4 Law a list of jurors impanelled.
verb
1 [ with obj. and adverbial of place ] display or arrange (things) in a particular way: the manifesto
^ "Computing an indexed set of related elements."
Hm, not quite IMO.
More like a region of memory occupied by a range of elements.
> Monomorphization is trickier than it may seem, actually.
^ Er.. I believe it.
 
@StackedCrooked does that not depend on the implementation?
well no
 
I suppose.
 
or does it
 
If you consider "associative arrays" etc.
 
1:24 AM
shit it's too low level for me
 
Alex you suck
 
I know
 
shakes fist
 
@Rapptz He seems to use this book.
Let's riff on that.
 
I actually tried to read it before
 
1:25 AM
sucks more coke through a straw
 
It's really bad
 
Game programming seems to be the bane C++.
 
man you can tell I didn't take random walks as I used to lately
I walked for ~3 hours today and now my feet are killing me
 
~3 hours in a single walk?
 
yeah, except for a 10 min pause to eat something
normally I'd be able to do this with no problems
also I've gotten even fatter
which could be seen as I was breathing more heavily than usual while walking
I'll turn into a wreck soon
 
1:28 AM
A walking an heavily breathing abomination.
 
:( that sounds even worse
 
I know, I'll just stop getting fat!
 
Keep walking and drink less cola :P
 
I found that not having lots of money helps too
because I have to stop buying burgers
and yeah cola
 
1:31 AM
Hi, where can I ask a coding practice question?
 
Nowhere.
 
@ConfusedStack Don't write crappy code.
 
@St
@StackedCrooked heh. that's why I need to ask a question.
 
If you want code review you can ask on Code Review
 
1:33 AM
ConfusedStackedCrook
 
If you want to talk about code design, you can ask on Programmers
 
How can I move something to Programmers?
 
you could flag it for a mod
but I think those are low priority flags
 
I'm dead tired
off to sleep :( hopefully this will also fix my legs
cya
 
1:34 AM
bb
 
Sleep well.
 
I wish I had a gold badge in :(
 
I just got this one:
> Socratic: Asked a well-received question on 100 separate days, and maintained a positive question record.
I don't understand what it means.
 
I asked a 100 well-received questions on 100 separate days?
 
1:45 AM
@StackedCrooked You already asked 248 questions? Whoah.
 
@MarkGarcia Thanks.
@MarkGarcia I recently found that DeadMG asked over 300 questions.
 
lol. I just remembered @Rapptz's attitude on questions. 0 questions. Ever.
 
@StackedCrooked Hm. Mod. They're currently deciding if they would award the socratic badge many times. You could have been a candidate for another one. And Bill may not like it. ~conspiracy~
 
I still have 0 questions.
 
1:50 AM
Not excactly an extraordinary achievement, but hey :P
 
> I can no longer speak with certainty because I left Adobe a few months ago and am now working at Google.
Wait. Didn't he use Adobe slides on GoingNative?
> 2009
 
He only stayed with Google for a year and then returned to Adobe.
 
Oh.
Says something about Google when it comes to C++.
 
I always suspected there are more than its fair share of stalkers on this chat, now I know ... :p
 
They come and Go.
 
user3010322
2:13 AM
@Xeo Good news, the function_traits bits and has_deducible bits work in VC++, no mangling required!
 
Could you guys/gals recommend a good resource on C++ exception handling please?
I'm trying to understand how to use exceptions instead of return values for errors, since the standard is return 0 which means if(!function) isn't helpful.
But if I use return false, there isn't a lot of errorcode information I can send if 0===false
 
2:30 AM
Are you a JS programmer?
 
why do you ask?
 
===
 
oh, sometimes used as "defined as" in reference to capital greek character Xi (three lines) which is kind of an equals sign with an extra line and used sometimes for defined as.
nope
I've seen professors write it on the board both ways
 
user3010322
o.0
 
user3010322
A confused Stack?
 
user3010322
2:34 AM
Is this what happens when you remained crooked too long, @StackedCrooked?
 
cooked
I'm confused
oh. no
 
Hello.
I'd just like to ask if anyone here is familiar with SDL2
 
user3010322
Maybe.
 
I really only use Python, and was trying to get by using the documentation for PySDL2, but it's severely limited. Since SDL2 is used natively with C++, I was wondering if anyone could potentially assist me with creating a Button of sorts.
I hope it's not a terribly stupid question, but perhaps the API references are similar enough
 
user3010322
Just... a button.
 
2:46 AM
Yeah.
 
user3010322
You're going to Native C++ and SDL2 from Python for... a button.
 
Is something wrong with that?
Hey, SDL2 has bindings for Python
 
Use PyQt.
 
user3010322
Have.... have fun with that, I guess.
 
It's not like I'm trying to write it in C++.
 
user3010322
2:49 AM
SDL is a low-level library.
 
user3010322
It does not care about buttons or GUI. Why would you want to use SDL to make a button?
 
@Borgleader yeahhhhhhhh
 
Oh PyQt costs money
 
user3010322
That's an absurd evaluation of your possible toolsets... especially from Python.
 
lmao
 
2:49 AM
i was using Kivy before
But Kivy doesn't support borderless windows.
 
user3010322
Yeah...
 
user3010322
My D:\ drive hardly responds anymore.
 
I've got no problem with creating a GUI in either tkinter or Kivy. I'm just trying to use PySDL.
 
user3010322
The upgrade to Windows 8.1 really did it in.
 
user3010322
I can't get any of my usual leftover music files to play.
 
2:51 AM
To create a borderless window you have to pass SDL_WINDOW_BORDERLESS to the last parameter of SDL_CreateWindow
 
I know that. I've already created one.
 
Thenn
 
The only issue I have is creating any sort of button
 
SDL isn't a GUI library
 
user3010322
You'll need the roll the logic for that yourself.
 
2:52 AM
I know how to capture mousedown events.
 
user3010322
You'll need to perform 2d hit-testing.
 
user3010322
Against mouse coordinates and your proposed button area
 
But I don't know how to specify them to an area of the window.
 
this is bringing back memories of sdlpp
memories I tried to banish
 
I wrote a function that stuck all possible coordinates of the exit button into a list.
 
user3010322
2:52 AM
@Rapptz git rektd, nird
 
But I felt going through the list to check if the current coordinates of the mouse were in it seemed ineffecient.
 
user3010322
@Owatch Extremely. Do you know what hit testing is?
 
At least Window creation was beautiful
so simple
so RAII
10/10
 
The Window does look pretty stunning
TBH
 
Oh I meant the API for my wrapper
 
2:53 AM
@ThePhD No, what is hit testing?
 
It looks like a plain old Window
 
user3010322
Google it.
 
user3010322
Google 2D Hit Testing or 2D Collision Detection
 
user3010322
You can also google AABB hit test, which is likely the shape of your button.
 
When I made my GUI library I didn't use collision detection lol
I just checked if the mouse was inside the rectangle
 
2:55 AM
Python isn't the greatest for this sort of stuff.
(Just in terms of speed)
 
I'm sure Python will manage just fine :v
It's not really that complex
 
But It's going to take me a bit to go through all this.
 
@Rapptz: Congratulations on your high score and accept for a code dump with no explanation.
 
No problem.
 
lol
 
2:58 AM
@Rapptz Well, that's what I'm trying to do.
 
@LightnessRacesinOrbit FWIW I gave you your 1st upvote. I'm not a sour grape.
 
It's just that as of right now, I'm creating a list of coordinate pairs that exist within the box. So I can check if the current coordinate pair is inside that list when a mouse event is detected.
Anyways. I'm off to google the 2D hit testing
So thanks for the suggestions!
 
Good luck.
 
@Rapptz I know. I'm clearly trolling you.
(Though you should put more effort into your answers...)
 
tbh I was planning to
 
3:01 AM
fgtw eh
that's cool
 
It was originally a comment for like 2 minutes :v
 
even more fgtw
it's ok; i'll simply kill your firstborn instead
 
Well you put me in a bad situation
 
don't see how
 
I can't edit it now because it looks like I'm copying
 
3:03 AM
holy hell, this has accrued a lot of comments
yeah well you put yourself in that position by being fgtw + slow :)
 
0
A: What is the difference of const and static const?

NTK88The difference is the linkage. At file scope static const A=2; // internal linkage const B=3; // external linkage If the i object is not used outside the translation unit where it is defined, you should declare it with the static specifier. This enables the compiler to (potentiall...

lol
 
Don't ask questions, then none of your questions will be unreasonably closed ...
 
Fuck, that was tedious. I should be asleep.
 
ITT robot makes robots
 
@Rapptz lol ... internal/external linkage ...
 
3:06 AM
@Rapptz The question (and its duped questions) basically boils down to what is static.
 
...and that conversation never goes anywhere
 
I still don't know if I should edit my answer :v
Man.
1
A: What is the difference of const and static const?

arielnmzIf the static const were to be declared inside a class it'd accesible from the class and any instance of the class, so all of the would share the same value; and the const alone will be exclusive for every instance of the class. Given the class: class MyClass { public: static const ...

That code snippet isn't even valid.
 
I can still get a few hours. Good night dawn.
 
Night.
 
Good night.
 
3:36 AM
@LightnessRacesinOrbit This is one step away from grey goo.
 
waiting for the day robots making humans ...
 
hi
 
 
2 hours later…
5:56 AM
Your humor enhancer module...
I think you might hve swallowed it
@sbi Morning
Well good day then
 
morning
 
I have cat-like reflexes (I hide behind furniture when I meet new people)
 
@R.MartinhoFernandes Looks good. Some of the solder joints need a little more solder to form a better mechanical connection. I will upload tedious...
 
6:15 AM
tedious: granted
 
And it worked... the second time... a set of wires had been wired backwards the first time. :-)
I almost "fixed" it in software, but then thought, nah, what's another 2 hours of soldering.
So the Clash of Clans servers are down. First message about 5 minutes ago, "Down for maintenance. Try again in one half hour". Tried a minute ago, now it says try again in one hour. I think they are having issues.
 
6:38 AM
GetProperty is in .net, why wouldn't it work in c++? =/ — James Hunt 2 mins ago
 
@Rapptz flawless logic
 
You hate everything Xeo
Soon you will be like Cat.
(I, too, think Pythy is lame)
pfultz2 really likes the preprocessor though.
You can really see it in all his projects.
He constantly advertises his Zlang thing.
It should be std::vector<int> &&x if you want to relay on move semantics. — Samuel 36 secs ago
?_?
 
Xeo
@Rapptz I hate it because it invokes UB
 
@Xeo It's been a long time since I've seen Pythy. I saw it once and ignored it. :v
 
7:42 AM
I didn't know about Pythy, but now I do. Thanks a lot guys..
 
7:57 AM
Let's have a role playing game, I will be a C++ program, you will be the compiler. Now you are about the compile me ...
 
And preprocessing is the foreplay?
 
It could be ...
 
@StackedCrooked Thank Obama!
 

« first day (1356 days earlier)      last day (3575 days later) »