« first day (2276 days earlier)      last day (1531 days later) » 
00:00 - 21:0021:00 - 00:00

9:00 PM
This one is good indeed stackoverflow.com/questions/549/… but not really about "passwordless" auth (with no password)
 
@Basj If you’re going to ask a new one, you need to be careful. Site standards have changed a lot over the years, and many of those old questions would be considered too broad or otherwise off-topic if asked today.
 
@CodyGray yep I know, but in this precise case it's a bit sad, because having a good canonical question about this classic passwordless auth would be super useful for many people
 
@CodyGray Which is sort of dumb. A lot of the old now off-topic questions are useful. They just require more effort to answer.
 
I agree that sometimes “too broad” is wielded as a bit too blunt of an instrument. But we do need questions to be reasonably narrow in scope in order to work within the Q&A format.
 
@S.S.Anne Stack Overflow isn't for "useful" questions, though. It's for a very specific set of questions.
 
9:04 PM
@CodyGray I'm guilty of that myself.
 
9:21 PM
 
9:40 PM
So the time where "what's the difference between if and switch?" is long gone.
I saw one with "What is the difference between 'git pull' and 'git fetch'?" the upvotes on that question is just unbelievable.
 
@Scratte Only because it's a duplicate. Otherwise, that's of sufficiently narrow scope to be asked here, as long as you contextualize it with a specific language.
What's not going to be allowed is "Which is faster, if or switch?"
 
I tried to find one, but specifically for java. I couldn't.
Oh. Why not?
 
As one of the people most ideally suited to answer that question, at least in the context of C or C++, I can tell you it's way too broad. I could write a book on it.
 
@Scratte That question is useful. I know it by heart now (git pull checks the files out), but it was a godsend when I was first learning to use Git.
@CodyGray Which is faster, 20 comparisons or a lookup table?
 
Yeah, nobody can figure out how to use Git. Questions about it are useful, and get zillions of upvotes.
 
9:45 PM
The reason we don't allow "which is faster" question is because they are so context-dependant
 
@S.S.Anne Impossible to say.
 
@S.S.Anne. Well.. it's a quick lookup in any git manual.
 
You need to know the language, the code, the compiler, the platform, the used/ available memory, the other running processes, etc.
 
How expensive are branches on your architecture? How expensive are mispredicted branches? Do you even have branch prediction? What are the chances that your inputs will cause the branch to be mispredicted? Also, what are your memory constraints? Will that LUT kick other code you care about out of the cache?
 
@TylerH So then I can provide a context..
 
9:46 PM
@Scratte But then if you can provide all of that then you can just test yourself
 
Good point :)
 
One generates some really wacky code in GCC and the other generates a 256-byte lookup table and some reasonably small code.
 
@Scratte Questions don't become off-topic just because they can be looked up in the manual. Such questions, while they may not be popular, are perfectly on-topic, and can be easily answered by quoting from and citing chapter and verse from the manual.
 
And good to have since SO is normally higher ranked then the manual is in the search results
 
Let me format that real quick...
 
9:49 PM
@CodyGray I'm guilty of getting answers from here when I searched for them. But for basic stuff I usually start with the manual. When I can't figure out how it works, then I go here.. where there's really nice explanations for slow-thinkers too
 
I hope by "format" it, you mean use Intel syntax, @S.S.Anne
 
No, four spaces.
 
Argh. AT&T syntax is an abomination
 
And here's the one with a lot of comparisons (but only 6):
        cmpl    $42, %edi
        movl    %edi, %eax
        movl    $1, %edx
        ja      .L2
        movabsq $5136780887040, %rdx
        movb    %dil, %cl
        shrq    %cl, %rdx
        notq    %rdx
.L2:
        andb    $1, %dl
        jne     .L5
        movl    %eax, (%rsi)
        ret
.L5:
        xorl    %eax, %eax
        ret
 
@Scratte While that is what everyone should do, most don't look at the manual. I think most don't even bother searching at all considering how many get closed as duplicates.
 
9:51 PM
@CodyGray like how is this not recursive?: Class Enum<E extends Enum<E>>
 
@Scratte I don't know what language that is
 
@CodyGray It's Java.. but not important. The idea was to say that somethings are just not very obvious just be reading the manual :)
@S.S.Anne: I think I might have to go back to the manual so get those %xxx sorted :)
 
Right. Not reading the manual is likely to get you downvotes, but it doesn't make the question off-topic. And there are plenty of cases where asking about the manual (i.e., for an explanation) is going to get you many upvotes and make for a great question.
% is a prefix in AT&T syntax meaning to interpret the following string as a literal register specification.
Apparently, nobody at AT&T was able to write a parser that could just match symbols with a look-up table.
You need $ as a prefix for numeric literals, too
 
@CodyGray Execute this one in your head and tell me what it does. (I prefer being explicit, so that's probably why I like AT&T)
 
segfault ...
 
9:56 PM
@NathanOliver I think you're right about that. I went through 20 suggestions before posting my Question just to make sure.
 
Returns false if input parameter > 42. Otherwise, looks in a look-up table packed into a QWORD, which is 5136780887040.
 
@NathanOliver But there's another downside to looking at the manual. You end up with a very large Question that no one bothers to read. Especially if it comes with code to try to sort out what's happening.
 
That's as far as I want to get. I can't even remember if AT&T syntax defaults to hexadecimal or not.
 
@CodyGray No hexadecimal. Here's a hint: 1001010110000000000000000000000010000000000
 
Okay, so your bit mapping is 100 1010 1100 0000 0000 0000 0000 0000 0100 0000 0000. It's going to index into the bit field at the index given by the input parameter, negate that bit, and return its value.
I also have a calculator
 
10:01 PM
@Scratte I actually like those Q's. If its a wall of code, I just close the tab and move on. If it's code inter-spaced with quotes and explanations I'm a lot more likely to invest my time.
 
I don't understand why GCC generates code to negate it when it could simply negate the magic constant.
 
Yeah...lots of things are sub-optimal there
The AND of the low byte of RDX is stupid.
 
@NathanOliver you're probably not the average user :)
 
True.
 
I'm with Nathan. Who are you calling "not average"?
 
10:03 PM
I blame -Os.
 
@S.S.Anne GCC's optimizer is not so great when it comes to bit-twiddling like this. LLVM is far superior.
Oh, yeah, that could be it, too. -Os is not great.
 
@CodyGray Sorry, you're too snarky to be average too :)
 
What's the input code, @S.S.Anne? I.e., Godbolt link, please? :-)
You can easily confuse GCC's pattern-matcher by using non-idiomatic C code, which is especially likely if you're trying to hold its hand and force it to generate certain machine code output.
 
Heh. As expected, Clang trounces GCC.
MSVC is generating the same code as Clang, which is somewhat unexpected and very impressive.
 
10:07 PM
Not gcc -O2 though. With -O2 they both generate the same code.
 
MSVC has been getting much better. I'm quite happy with it.
 
Ah, so they do. That's...odd. BT is a short instruction. Why would it not be using it with optimize-for-size enabled?
It would make more sense to avoid BT at -O2, since it's not exactly fast.
'Course, it's no slower than a 64-bit shift...
Okay. GCC is avoiding BT because of some architectural concerns. -Os -march=haswell gets you the code you expect.
So some heuristic in its "generic" x86-64 target arch is telling it to avoid BT.
 
I came across this trying to compare against some of C's punctuation characters.
 
Wait, no. Actually, you're just using an old version of GCC.
 
What a coincidence. I am running haswell.
 
10:13 PM
GCC 7 learned about BT.
 
Yeah... I'm using Debian 9 in a container on a Chromebook.
But it's better than having bad support in Developer Mode.
 
What's "Developer Mode"?
 
GCC 9 and clang 9 produce pretty similar code: godbolt.org/z/BQfA-H
 
You remove write-protection on / and lose ability to ask on support forums. I have no need for it anymore now with this container.
 
@NathanOliver Yep, I reached this same conclusion a couple of lines back. S.S. Anne was compiling with and old version of GCC (circa v6), which doesn't appear to know about the BT instruction.
Hmm. I wouldn't be too worried about losing the ability to ask questions on a Chromebook support forum.
It's a Linux distro. What's the worst that's going to happen? Whatever it is, you can fix it.
 
10:18 PM
Bricking the system with no way to sign in and losing all my files on an encrypted-by-default hard drive.
 
I'm wondering, are coding requests like this on-topic? stackoverflow.com/q/60178654/2675154
 
Your code seems odd, @S.S.Anne. Why would you need a function that assigns and returns the result?
@honk No, not like that.
 
@CodyGray Just a random example. If you don't return a value it's pretty much the same thing.
 
@CodyGray Ah, needs more focus. Thanks!
 
@S.S.Anne As a demonstration of how much difference it makes to the optimizer's pattern-matcher when you write the code differently, consider this.
ICC and MSVC still know to use BT, but neither GCC or Clang act like they've ever heard of it.
And that code is simpler and more obvious.
 
10:21 PM
That's bad.
 
GCC is pathological in this case.
It gets better if you change the short-circuiting || to a bitwise |.
 
Just add a simple ?1:0 and it works.
 
No...
OMG
 
The branch in the original code causes it.
 
There's no branch in the original code!
Casting to bool doesn't work, and neither does masking off all but the lowest bit.
 
10:24 PM
My code. The if.
 
I'm focused more on why GCC needs that conditional operator to not suck.
 
@CodyGray not sucking is only conditionally supported ;)
 
Dang, no kidding. I find myself saying "OMG" a lot whenever I analyze the output of "GCC". Funny, those TLAs.
This is seriously pathetic, but I've actually seen similar things before where GCC is unable to see through a short-circuiting comparison operator and turns it into a branching nightmare, instead of a sane bitwise test.
Paradoxically, changing || to | breaks MSVC's pattern-matcher...
You cannot win.
 
Does ?1:0 affect the output of the other compilers?
The x64 MSVC flunks too with that long chain of short-circuiting operators: godbolt.org/z/Zf7kG-
 
No, seems they're all fine with that. Unsurprisingly, since it's literally a no-op. And therefore, as we say in Texas, I guaran-damn-tee it that someone is going to come along later and remove it from the code, the same way as you'd remove an if (x == true)
@S.S.Anne MSVC doesn't have -O3, so you're looking at unoptimized code. You can pick from either /O1 (which means optimize for size, equivalent to -Os, except not stupid) or /O2 (which means optimize for speed, basically equivalent to -O2).
 
10:35 PM
I'll add a comment explaining the stupid compiler behavior if I ever switch back to not using a lookup table and publish the code.
 
Yay! Your code will then look like libraries that I write.
Giant paragraph blocks of comments explaining why code is written in an apparently-nonsensical way, with snarky remarks about the output on various compilers.
 
Stupid nonsensical code to generate good assembly
 
Whatever you do, don't use an algorithm: godbolt.org/z/Rstrsn
 
@CodyGray I want to see some of your libraries. Maybe I can learn to trick the compiler into generating good code.
@NathanOliver Yeah, but that's C++. You never get good assembly with C++.
 
11:55 PM
Folks, the thing about "optimizing" compilers is that they have to obey your code!Write good code, then they (probably) don't need their tricks; write 'daft' code and they'll optimize you away! I once did a 'test' on my code with Intel C++ versus in-built MSVC - no noticeable difference,
... it was a 'sort of 'FFT'.
 
00:00 - 21:0021:00 - 00:00

« first day (2276 days earlier)      last day (1531 days later) »