« first day (2148 days earlier)      last day (2801 days later) » 
00:00 - 14:0014:00 - 00:00

2:01 PM
Is it possible for me to represent a power series formula with a set number of iterations in a #define in C?
like a for loop to add each term up to N terms
and then have that summation as my #define value
not a macro that will substitute code at run time
 
> not a macro that will substitute code at run time
 
Ben
what?
 
like say #define MAX_NUMBER 5
I want to use something as simple as that in my code
but instead of 5, I want a formula
it will be constant, but I just want to change an iteration number to change the formula value
 
Ben
@EwokNightmares so write a function? I'm not sure what you are trying to do.
 
doesn't the function get called then as a macro?
 
2:03 PM
In C? That's gonna be a total PITA
 
I want to make an array and I know its size is fixed at compile time, but that size is determined by an iterative formula
so I just wanted a #define that would calculate it for me and use that for the array size at compile
 
Ben
@EwokNightmares so you want to call a macro from a macro?
or something else?
 
ya probably
 
if I could I might be able to do it
 
2:05 PM
what type of formula?
 
he wants compile time computations
 
power series - 1
 
plain integer math should work
 
so if my size is 3, and my iterations is 4, it would be 3^0 + 3^1 + 3^2 + 3^3 + 3^4 - 1
but I don't want to type that out every time I change the iteration count
 
Ben
@EwokNightmares did you know that you can resize arrays at runtime?
 
2:06 PM
i want statically allocated
 
no, not really; you can't resize most of them
 
or just live with the fact that the higher order coefficients will be 0
 
I'm making a tree structure out of a static array
 
@EwokNightmares Try checking whether Boost.Preprocessor can handle it
(sure, it's Boost, but Boost.Preprocessor works for C too)
 
ok I didn't know that
I never used boost actually
 
2:08 PM
it's a C++ library
but see above
 
ok thanks I'll check that option out
 
otherwise if it doesn't, you can just generate the header yourself
with a program
sure, that's another step in your build, but is that really a problem?
 
just seems like programmers have endless tricks up their sleeves that I keep finding out
 
Ben
@milleniumbug what I meant to say is that arrays in C can be assigned more memory.
 
so I was hoping this would be 1 of them
 
2:09 PM
compared to the boost macro it may even be faster to just generate the file during build
 
@Ben they can't
not automatic nor static
 
C's compile time computation is pretty limited
 
Ben
@milleniumbug but I've just tested it, and an array can be allocated memory, given that the size of the element type is known.
 
8 mins ago, by milleniumbug
not automatic nor static
 
Ven
Finally done with this shit C/PHP/Nim project.
 
Ben
2:21 PM
ah, I see. Your right @milleniumbug.
 
Ven
Your right to live
 
Ben
@Ven my 'right', or I am right to continue living?
 
Ven
@Griwes turns out I need repe cmpsb :) (well, repz is most definitely the same like je/jz)
@Ben You're right.
 
your left
 
nwp
why is this getting upvoted? I don't understand.
 
Ven
2:28 PM
@nwp: Yeah, the question is just wrong about that. — Kerrek SB 7 mins ago
 
nwp
> "you asked the wrong question, it doesn't fit to my answer"
 
Ven
> clang -cc1as: fatal error: error in backend: 32-bit absolute addressing is not supported in 64-bit mode
Fucking christ. How do I get .ascii to work on 64 bits :(
movabsq.
> In 64-bit code, movabs can be used to encode the mov instruction with the 64-bit displacement or immediate operand.
/cc @Griwes
oops, repe cmpsb kinda fails if the string don't have the same length ;D
 
2:52 PM
@Mikhail If you don't see it, you aren't looking. First of all, even assuming they simply incorporated Clang's code into CL, that's still more than they did on CL from about 1997 through 2002 or so. Second, they're clearly putting (for one example) a lot of work into the library that they didn't used to.
 
Ven
Bah. I'll look at it tomorrow. Thanks @Griwes for the pointer, I was about to use that simd one.
 
@AndreasPapadopoulos I am traveling back home passing Shenzhen and will stay there for half a day on 10th Oct, want meet up? The rest of the journey is a bit far or not enough time
In the afternoon, on a Sunday
 
nwp
git status
fatal: Not a git repository: path/to/not/a/repository
inside a git repository
that has some submodule path not set correctly somewhere
 
cat .gitmodules?
 
nwp
not in there
 
2:59 PM
.git/config?
 
@AndreasPapadopoulos correction, 9th Oct
 
nwp
no, at least path/to/not/a/repository doesn't appear anywhere inside .git/config
 
yeah sure, play coy
 
@Ven A simd one looks somewhat like this. :D
 
Ven
3:12 PM
@Griwes yeah I was looking at the jvm's. But mine segfaults when the 2nd string isn't longer than the first...
 
nwp
@R.MartinhoFernandes this helped a bit, found my offending submodule
 
@Ven .asciiz instead of .ascii should help.
@Ven Even the C standard library specifies the behavior is undefined for not null terminated strings.
 
nwp
hmm, never mind, I'm just screwed
 
For non-null-terminated you have to use strncmp, where you know the value to put into rcx (or ecx, depending on your CPU mode).
 
Ven
@Griwes i tried ascii and asciz, but not asciiz...
 
3:20 PM
@Ven Oh wait, it's spelled .asciz.
Apparently there's also .string.
My GAS directives are somewhat rusty.
 
Ven
@Griwes then I tried it and it didn't work :P
 
nwp
deleting submodules fixed the repo and then I could just checkout the files that I deleted...
 
Ven
I only do x64 on fridays so I'm sure I can drink enough to forget about it.
@Griwes i'll try again later...
 
@Griwes strncmp is for times that it may be NUL-terminated. That is, a NUL does terminate the string, but if you don't find a NUL before N characters you stop there. If it's strictly "length of N" (even if that might contain some zero-bytes), you want to use memcmp instead.
@Griwes It's not you, it's GAS that's rusty.
 
Please god help me I need the discord invite.
@milleniumbug helppp
 
3:40 PM
@Ven Look, look! The whole band is out of step, except for my son!
@Griwes Of course, my blaming GAS for most of the evils of the world may stem from its usually meaning on photography web sites (Gear Acquisition Syndrome).
 
Ven
@JerryCoffin reminds me of the day everyone was going backwards on the freeway
 
@Ven When my friend visited from Great Britain, he complained about that.
^-- As usual with me, it's obvious I'm lying. Anytime I claim to have a friend, you just know better.
 
I thought your friend would be complaining more about driving on the wrong side
 
@JerryCoffin lol
 
Cleanup on aisle three
 
3:56 PM
@Telkitty After having been married as long as I have, I'm accustomed to that.
 
I could eat a polar bear right now.
 
@Griwes That might upset sehe a bit.
@Griwes Damn you! Now I need a snack...
 
not sure if troll or extremely dumb
 
who says troll can't be extremely dumb?
it's not mutually exclusive
kids: maths is vital to personal development, spend more effort on it
 
4:12 PM
@sbi Nah, I saw that building and thought of you, so took a picture :)
 
@caps You've been writing C (or related) code for more than two weeks, and you still expect something to be intuitive? That's so cute... :-)
 
@JerryCoffin I actually haven't written any Code except for the C++ code that happens to be C compatible (which is almost none of it). I have been maintaining some C-style stuff the last few weeks though.
 
@набиячлэвэли give discord invite pls
 
@набиячлэвэли That is what I would expect. I did not understand that to be what @JerryCoffin was telling me
 
@Nooble Can't, plink a mod
 
4:21 PM
:C
 
@Nooble @TonyTheLion
 
user image
12
lol
 
@набиячлэвэли We just need somebody with cant as their user name to turn this into a whole conversation: `Can't. Plink a mod". "Can't plink a mod." "Cant, plink a mod."
 
4:34 PM
@набиячлэвэли apparently, I no longer am one. Disappoint.
 
Ven
@sehe :(
#noBully
 
user406009
@Nooble I just sent you a code over facebook.
 
user406009
(From Elim)
 
user406009
@набиячлэвэли Lol. I guess that's the "right" way to do this sort of thing.
 
user406009
Cryptography for the win.
 
4:50 PM
@Lalaland This definitely falls under "security via (a minimal level of) obscurity."
 
@JerryCoffin I posted a link to a PGP-encrypted invite code
There's no obscurity there, only security
 
@набиячлэвэли Okay.
 
Hello, Cruel World!
 
Ven
5:39 PM
@nwp yeah i read that already... So?
@Jeff the standard explains a lot about them
 
nwp
I thought it would be new and interesting, my bad
 
Ven
@nwp sorry. I thought you were trying to make a point. But don't worry, I'm fully awarenof x86's insanity
 
6:07 PM
 
6:31 PM
good evening various assorted losers and also robot
4
@JerryCoffin I once thought it the height of humour to use "yourself" as my username.
you could get great outcomes like "You killed yourself with a shotgun"
 
nwp
47
Q: How is this "question" not spam?

Sven SchoenungI came across this "question" in review: At first I thought this was just yet another review audit because the question is so obviously spam. So I proceeded to flag it as such. Turns out it wasn't an audit. However the question wasn't deleted as spam. Instead it was put on hold by a moderator...

mods vs community action
 
@Puppy Years ago saw a column advocating something similar. When filling out a software license, fill out your name as "everyone" and your location as "the whole wide world", so when it starts up, the splash screen will say: "This software is licensed to everyone at the whole wide world".
 
6:51 PM
@JerryCoffin Was it run by FOSS?
 
@Mysticial No--this was for "tricking" commercial software.
 
oh ic
 
7:19 PM
@R.MartinhoFernandes what's your opinion on github.com/tahonermann/text_view? I like it, but I don't like it's sitting on the bleeding edge so much that it will take years to be viable for mainstream, I fear
 
7:38 PM
0
Q: Best way to check if integer does not equal 0 in C++

Arnav BorborahContext: I was writing a program in which the user has to enter 2 numbers, but they cannot be 0 for the computation. Knowing that, I had to check user input so it isn't 0. I currently have 2 methods to do the above. Here they are below: Method 1 int i = 1; if (i != 0) { //.... } Method ...

^^ So yesterday at work, I spent a disproportionate amount of time trying to figure how to check if either of two numbers were zero.
 
@Mysticial ((a==0) != (b==0)), or cooler: !!a!=!!b
 
@sehe That's what I originally wrote. Until it didn't look very good under VTune.
 
@Mysticial oooh you didn't ,ention :)
 
@sehe GCC generates two branches. It checks the first part. Returns if it's true, then it checks the second part. The problem is that the nature of code is that it's unpredictable which side is zero. But it's predictable whether either side is zero.
 
7:45 PM
@sehe Chained boolean expressions don't compile that well on x86 as you need to convert flag bits into normal registers. GCC knows that so it decided to split the branch into two because perfect prediction is faster than boolean arithmetic.
 
@Mysticial So, I guess you composed a value like ((a!=0)*2+(b!=0)) and threw it through switch?
 
@sehe I tried like a dozen different things include something similar to that. None of it worked. Actually a switch is multiple branches, so it wouldn't worked either.
I ended up doing a double-wide multiplication. Because a multiplication will return zero if either number is zero.
7
 
@Mysticial Depends, right. Some get compiled to jump tables, I hear. But I trust you to actually try it out :)
 
That was the fastest, I couldn't believe it.
 
@Mysticial Wow.
@Mysticial Make it a SO Q&A :)
 
7:49 PM
@sehe It was very hard to believe when I saw it. A 64 x 64 -> 128-bit multiply followed by an bitwise OR of the two halves was faster than any sort of boolean logic.
But numbers are numbers. They don't lie. And Agner's latency tables somewhat explains it.
 
nwp
New Ajax with instant bleach removes stubborn stains without scrubbing! For fast, easy removal of stubborn stains, greasy film, black pot marks... more and more women are switching to new, pure white Ajax. Nothing cleans and bleaches better than new Ajax. — Two-Bit Alchemist 2 hours ago
Don't worry, guys. It's fine. I don't work for Ajax. — Two-Bit Alchemist 2 hours ago
 
@Mysticial It;s a clever find. Does the perf depend on CPU arch and iteration?
 
@sehe We only care about Haswell and later atm.
 
@Mysticial This Q&A is worth my votes if you post it
Sry guys. I got lost in tabs
 
8:13 PM
What's goin' on
 
@sehe It's too specific for this particular application.
 
@Mysticial No its not.
@EtiennedeMartel question time in the lounge!
 
Questions pour un champion
 
@Mysticial Same could be said for most of your high earning answers...
 
nwp
stars are transferable to other rooms, interesting
when SO goes down they should make a star room that dies last
2 messages moved from C++ Questions and Answers
 
9:26 PM
Interesting developments. Moved question barrage to question room.
Question room now more active than lounge. /smh
 
9:40 PM
such a nuke
 
such a sensitive kid
 
better nuke messages than ME
 
better look at context, goal and reality than message counts
 
Ven
9:57 PM
@sehe why'd you move the starred one ):
 
Why not? I tried to keep the convo together. I might have missed a spot (or two)
 
10:28 PM
what madness is this
 
@JerryCoffin I can't imagine what a fantastic victory that must have been.
 
@CaptainGiraffe To be honest, I think it meant more to the others on the team than it did to me. They'd all looked at the old code, and decided that job was fearfully complex. I'd glanced at the code enough to decide I'd rather rewrite than patch it up, but mostly looked through the spec and thought it was simple enough that I fully expected it to work quickly and easily. A few others (who probably should have known better) were downright amazed though.
 
I only get those rare hallelujahs when I'm writing my own code. But I do remember once in a parser (I think it was plain xml) I used three or four gotos to make the parsing a lot more readable. I linked Dijkstras "Letter to the Editors" as a pdf to that file =)
 
@ChemiCalChems Hello.
 
10:43 PM
@JerryCoffin So at the least you got a very neat story out of it.
(*) as a lecturer I rarely use other peoples code for teaching purposes.
 
:O
-13
Q: Probability in c++ language

علی بھڈیراQuestion.: Write a piece of code which outputs return ‘*’ with probability 4/7 and return ‘#’ with probability 2/7 and return ‘@’ with probability 1/7??? How you will solve this problem?? https://www.facebook.com/groups/610372552482766/632805130239508/?ref=notif&notif_t=group_activity&not...

it's incredible
 
Why on earth did Ben edit this nightmare?
 
@CaptainGiraffe That too. To me, the big gain was simply that something was (more or less) permanently fixed, so I could move on to other things. This is part of why I find programming a good fit: when I fix something, I like to think of it as fixed forever.
@jaggedSpire It appears to be self-answered, so he actually did at least make some attempt at writing some code.
 
@CaptainGiraffe to remove the incomprehensible facebook link, looks like
 
@JerryCoffin We do differ there=) If I fix something I do expect to find another bug, showing me similar symptoms, making me wonder if the first fix was a fix at all.
 
10:50 PM
@JerryCoffin I figured that was an attempt to do as the comments requested and show some work
 
@jaggedSpire In the review queue this is tagged as "not an improvement"
 
@jaggedSpire Maybe. I didn't notice the time stamps (and don't care enough to look again).
 
@CaptainGiraffe how did that edit make it into the review queue? He's got 10k rep
 
@CaptainGiraffe If the first didn't work, it's not really a fix. I'm bothered more by doing the same thing again. Like in my old house, when I replaced some plumbing, the replacement was when "new". At least at first, it really bothered me when I had to replace the same thing ~10 years later.
 
@JerryCoffin it looks like about a minute between the question and the answer post. Makes it pretty ambiguous if it's a bad attempt at a self-answer that they failed to do right from the question post page, or a response to the comments
 
10:59 PM
@jaggedSpire Yeah, who knows. Under the circumstances, I'd tend to give him the benefit of the doubt.
 
@JerryCoffin I have a 22 year old precious car. Don't get me started. youtube.com/watch?v=lE47EQawico
 
@JerryCoffin yeah, he certainly doesn't need more anger headed his way
 
11:23 PM
Xcode8 beta bug. Can't change font back. Serves me right. https://t.co/9yagdZ23Bk
Beautiful
Ooh. 01:23:45 o'clock
@CaptainGiraffe That's what she¹ said (¹the car)
@CaptainGiraffe Why not?
 
11:38 PM
@sehe Ben's edit?
 
you know. The arrows are there for a reason. ... :(
I should be sleeping
 
I followed the arrow. I was surprised you held an edit of that kind of post in any regard. That was why I was curious if you'd linked it correctly. Yeah that was a trainwreck. You can't stop a trainwreck with or without facebook links.
 
Seems like using the address of typeid could also be used as a hash. I wonder how it compares to type_index::hash_code().
How does one check the quality of a hash?
Ah, just use it to populate a hashmap and check for collision count.
Seems. type_index::hash_code might be better after all.
 
lolllll passive rep on a haskell answer of mine, i forgot i even had one of those
 
11:55 PM
@CaptainGiraffe So what? It takes 3 seconds to remove a potential spammy link. It's a no-brainer. It takes a lot longer to think about whether the post has enough merit to even .. yada yada yada.
If I had to weigh my contributions like that, I'd never do a thing.
 
00:00 - 14:0014:00 - 00:00

« first day (2148 days earlier)      last day (2801 days later) »