« first day (845 days earlier)      last day (4096 days later) » 

5:09 AM
oy I got downvoted. cool.
for saying string literals end in \0 I don't know how else to explain it
maybe it's my fault.
no it's fine
 
ISO standard i think specify that string literals are to end with the null character
Also that line feed is to be converted over to the OS's new line combination
 
-1 This has nothing to do with strings being null terminated. It has to do with the fact that he's trying to compare a string literal to a character - apples and oranges. — Jonathon Reinhart 2 mins ago
this was the comment I got, I guess I can understand it but meh
might as well take my downvote like a man :(
 
He's right though. Just delete it if you don't want to fix it.
 
@Mysticial I haven't gotten a -1 in a while so might as well keep it.
 
@Rapptz lol
If you let it stick around though, you might get more.
 
5:14 AM
Well, how would I fix it?
 
@Rapptz haha, really want to keep it?
 
I would've deleted it in shame right away.
 
I have no shame.
I don't care lol
 
@ScottW Unlikely. I've only ever downvoted 3 posts - all deleted.
 
I'd at least like to know why my reasoning is off rather than "-1 for comparing different things"
So if you guys can be more helpful, go ahead please.
 
5:16 AM
I downvoted one very sketchy question, as well as two wrong answers.
 
I just realize all deleted post are still there. ppl with 10k rep can see that.
 
@billz Yeah, it's why I usually edit before deleting
So if someone wanted to see it they'd have to click revisions
Most people wouldn't bother I don't think.
Anyway, suggestions on how to fix?
Is he not comparing a single character to a character array holding the null terminator?
 
@Rapptz you will be suprised what some people will do
 
The guy who downvoted me suggested doing "U"[0] only reinforcing my point, so I don't understand
 
me neither
 
5:18 AM
"U" is a const char *
[0] dereferences at index 0
So "U"[0] returns 'U'
 
What stackoverflow question is this?
 
@Rapptz My question's got hooked on meta. :)
 
@Mysticial and what would [1] give you?
 
@Rapptz nul-character
 
lol
 
5:20 AM
yeah, guess so
 
[2] would be UB
 
:| I still don't get why I'm wrong, sorry
a const char* is still an array of characters isn't it?
 
I am going to delete my post, they have much better answer than me
 
Let's say for argument's sake that we're dealing with DOS strings which are $ terminated. The problem is still that it's an array of chars, and he's comparing a pointer to that array - not that it's null-terminated. I wouldn't have been so picky, but the OP was asking about specifics. — Jonathon Reinhart 1 min ago
DOS strings o.o
ah well. Whatever.
 
AHA!!! I found where the traffic was coming from!
 
5:24 AM
yeah I thought you saw that
forgot to mention it
 
I was wondering for a while...
Some guy got a publicist badge for it.
But I didn't know from where?
And I wasn't able to find it via google search.
 
I should post popular questions on reddit.
 
Yeah, this guy's been spamming links all over Reddit and HN.
 
your answers.
 
@Rapptz I just had the illusion that the picture winked. Damn.
 
5:27 AM
@Rapptz I only found it when I searched through recent SO submissions to Reddit.
And that flops one popped up along with a shit-ton of other ones...
 
I feel so bad for laughing hahaha
 
wut
 
allergic reaction to hair dye
 
@rici I decided to post a solution that optimizes more for idiomatic C++.
 
5:36 AM
@Rapptz oh ic... ow...
I didn't see the title.
 
@Rapptz Ah lol I get it, finally. I was thrown off by the fact his hair color didn't change at all.
 
@JerryCoffin I was going to do that one!
but I decided against it because lambdas are ugly but you did it without them so
 
@EtiennedeMartel wtf.
 
@Rapptz lambdas are fun. Cowdas and horsedas are ugly.
 
@AndreiTita SOUUUPE OPPÉÉÉÉRRAAAAAAAAA
 
5:40 AM
@JerryCoffin That was a terrible joke. Are you having a contest with @Etienne?
 
@AndreiTita Nope -- being terrible just comes naturally.
 
@Rapptz I don't get it.
 
Indeed, there's no way I can be as terrible as Master Coffin.
 
ah it's just a male on male relationship
I'm not sure how to phrase that better.
was it that bad?
 
5:46 AM
@Rapptz Some might object to it.
 
Oh.
 
@Rapptz Did you see it?
 
Nope.
Ah.
I don't think that's so bad.
 
I've seen people get flagged for lots of things.
 
but you only have 2k rep!
 
5:51 AM
@Rapptz Just for you, I added one! :-)
 
well yeah I've seen 10K's show pictures of silly things getting flagged in the C# room.
 
@CCInc If you flag me down, I will become more powerful than you can imagine!
 
hold on a minute
Why ask this when you asked this earlier?
 
I can see what Jerry said... Not sure why it's inappropriate...
 
I'm so confused
 
5:54 AM
@Rapptz He really has no idea what his code does.
 
@Mysticial Some take being called a "boy" as an insult.
 
@JerryCoffin oh...
 
@CCInc The C# room is also known for being quite flag happy.
Not as much as the PHP room, but still.
 
Heh heh.
I heard, actually it was another room that was flagghappy
 
@CCInc Here we use semaphores instead of normal flags.
 
6:10 AM
Can an OP change the entire question like that?
 
uh...
Ask the OP
 
Imma just vote to close as dupe of jerry's answer
 
@Rapptz He can. It's usually a lousy idea, but possible anyway. I've sometimes been tempted to ask something about, say, SQL, then change it to a question about, say, computational geometry, so all the answers would look completely insane to anybody who can't see the edit history.
 
If something in the standard says //undefined next to a class does that mean it's implementation defined?
 
@Rapptz It probably means something closely related to undefined behavior. Where are you looking?
 
6:17 AM
§ 30.6.1 pg 1145
 
@Rapptz I think most it is up to the implementations to fill in the blanks for undefined behavior, and they usually do.
 
for packaged_task
template <class> class packaged_task; // undefined
is what it says on N3376
 
@Rapptz In this case I believe it means there should not be a definition of that template (though I'll admit, I haven't looked at that enough to be sure why it does that).
 
@MarkGarcia Hm? I think implementation defined and undefined behaviour are two different things :P
@JerryCoffin Ah that's weird
 
@Rapptz But as what I've seen in most implementations, there's really something that happens in undefined behaviors.
 
6:23 AM
Hm, I wouldn't know because I avoid it.
 
@Rapptz Yes -- UB means anything can happen; it can be completely unpredictable. IDB means that what's going to happen has to be documented. They could document something as "will destroy the machine", though, so the difference is pretty minimal.
 
@JerryCoffin People would be somewhat less likely to use that compiler, though.
 
@AndreiTita Probably (at least if they have a viable alternative).
 
Error in Lua: "attempt to index a number value". They could at least tell you the variable name.
 
@AndreiTita Well, you know, it's a simple language. Just write your own implementation that gives better diagnostics. No big deal. :-)
 
6:34 AM
@JerryCoffin Actually I could go into their implementation and improve that error if possible.
Fortunately in this case the error was not actually in the script file.
Although I still need to find it.
 
@AndreiTita In (4).foo there is no variable.
 
@LucDanton I thought Lua doesn't throw away variable names even after compilation, though.
Because obviously I don't have 4.foo written somewhere in the code :)
 
@AndreiTita Yeah, should be able to. Might not be trivial though -- undoubtedly written more for efficiency (especially small size) than readability.
 
What if you have foo().bar then; and so on and so on.
 
6:53 AM
Fixed.
 
@JerryCoffin: ok, i added mine, and a more efficient idiomatic c++ (at least, it should be idiomatic since it uses the standard library).
@AndreiTita: by default, lua keeps enough information to identify local variable names. Globals are a lot trickier.
but basically, to tell you which variable the value was from, it would have to examine the compiled code, after somehow recognizing that the value in question was at a particular stack location.
 
@rici Well, it uses vector, anyway. I thought about partition, but didn't see how to make it work here. Your idea is good, but I think you have a minor error -- I'm pretty sure you intended the condition to be something like first == a%10. As-is, I believe the condition should always be true (it always compares n[0] to n[0]).
 
@JerryCoffin: right you are. Last minute edit.
(Trying to not compute n[0]%10 every time.)
Before I "optimized" it, it said a%10 != n[0]%10. My excuse is that it's 2am.
 
7:10 AM
@rici Yup -- happens to all of us now and again.
 
indeed.
 
One possible modification to the other: return i + (i == n.size() - 2 && n[i]%10 == n[i-1]%10);. Some people don't like that sort of thing though. :-)
 
@jerryCoffin: the other thing i thought of was replacing the return inside the loop with a break, and modifying the condition at the end slightly. The problem is that the slight modification then has to deal with the case where n == 0.
I certainly could have phrased the last if as a ?:, but meh.
at least, the algorithm is interesting. the precise implementation details are boring.
and it's bedtime. cya.
 
@rici Later.
 
7:24 AM
Meh. Having brown as a player color was a poor choice when I need to write text in that color on a brown background.
 
7:47 AM
Perhaps it's just that I don't know some C++ special trick, but so far making enums flaggable and other fun things is still all about macro trickery...
 
msvc allows this! took a while to make a search that shows how to properly define a template member of template outside the class.
 
@doug65536 gcc and Clang allow it too, with proper syntax
 
the whole point is that it works with incorrect syntax in msvc
 
Ah. You seemed excited-happy about it.
What does MSVC do with usual syntax?
 
was annoyed that msvc has me fooled that I knew how to define a template member of template class outside the declaration
@AndreiTita good question, let me check
 
7:54 AM
I've been using the normal syntax with MSVC when I had something like that and it worked for me.
 
Any of you seen Wikipedia's fund raiser. Hurts my eyes.
 
Nope.
 
@__@
-pedantic doesn't allow me to stick an extra ';' in places?
 
For real, -pedantic? You're that much of an asshole?
 
7:57 AM
@MarkGarcia Ouch. The goggles do nothing.
 
They probably to it to annoy all of us, forcing us to donate.
 
Anyone have any idea how to have an allowable ; at hte end of a macro that is in the global namespace (and not inside a function) ?
 
@ThePhD The robot had a trick involving static_assert(false) but I don't recall the exact code.
 
What should I do for this question stackoverflow.com/questions/14731756/… I made a typo and got a reasonable answer, but it wasn't what I was looking for
Should I edit the post or accept the answer and repost a very similiar question
 
@AndreiTita Got it. static_assert( true, "Fuck you" ); does it.
 
8:00 AM
@ThePhD Ah yes it would be (true) ofc.
 
And now I have Flaggable enums for C++.
Which isn't too terrible, but still.
It's macro nonsense. I wish I could built-in this stuff, but enums are so fucking awkward in C++.
 
@AndreiTita It was my fault, msvc only accepted the correct syntax. no idea how it compiled before though
 
@doug65536 rofl.
@ThePhD It's cool
I have some flags in my code which used... let's see...
 
What'd make it a little more robust is to have enumflagoperators take a second type
 
struct TextStyle
{
static const unsigned NORMAL = 0;
static const unsigned BOLD = 1;
static const unsigned ITALIC = 1<<1;
};
 
8:02 AM
which is meant to be the underlying type.
Ah, structs and unsigned.
I used to do that, actually.
I've been slowing replacing it, but I actually kinda hated it when I replaced it
because then I couldn't put functions inside TextStyle to operate on TextStyle stuff
 
Normally I'd use a C enum but this had to be in global scope
 
And instead had to use GLobal Free Functions
C enums are so gross.
They pollute the namespace so hard.
"YOU DON'T NEED THIS VARIABLE NAME EVER IN THE REST OF YOUR CODE FOR ALL ETERNITY, DO YOU?"
 
What annoys me about enum class is that you can't define implicit conversions even if you really, really want them.
Otherwise they are nice.
@ThePhD Yeah that's awful.
I used to have enum HAlign { LEFT, CENTER_H, RIGHT} and enum VAlign{ TOP, CENTER_V, BOTTOM} because of that.
 
I've seen APIs use "middle" for vertical center to work around that
 
@doug65536 DX does something like that.
 
8:06 AM
DX just appends shit to their enums
 
It's "center" and "vcenter"
iirc.
 
D3D_SHADER_VARIABLE_FLAGS::D3D_SVF_(Value)
So the global namespace just has lots of D3D_(EnumAbbreviation)_(Value)'s in it.
 
the global namespace is already a disaster because of windows.h right?
2
 
@doug65536 If you use windows.h
 
yeah, meant in directx context
 
8:08 AM
DirectX includes parts of Windows.h without telling you anyways,
so your global namespace is already a mess if you're using DirectX.
 
How does one weigh colors in a sampling AA? sum(color*alpha)/pixel_count?
 
Uh
 
@AndreiTita I think you should consider the neighboring pixels. (or is it a different AA method)
 
That's giving equal importance to each pixel that you're talking about.
 
@MarkGarcia yeah, pixel_count refers to neighboring pixels
 
8:10 AM
Which isn't always the best way to go.
There's complicated sampling techniques when it comes to up and downsampling...
neighboring pixels is considered the most naive one.
 
@ThePhD It's 2D.
 
it would be bilinear filtering then right? not AA?
 
... Um. Okay?
 
@ThePhD So I don't need to worry about perspective, lighting, and polygon edges.
 
you mean pixel count as in stacked samples? variations of same pixel?
 
8:12 AM
@doug65536 Nah, I just want to handle the edges.
 
Everything I mentioned is for 2D.
 
@doug65536 Neighboring pixel count, as in the 4 samples in a 4x sampling AA.
 
@AndreiTita Ah. I get it now. You mean the result would be the average of the pixel and its neighbors, right?
 
there's a hack where you can use the pixel coverage for the alpha at the edges
 
@ThePhD Ah ok.
 
8:14 AM
downsampling to 1/4 size then yes, average would be fine. probably not the best algorithm but good
 
Anyway I'd better keep writing that shader, then I'll see what the results are anyway.
Thanks.
 
In your case, you're doing multisampling to get better resolution is at the edge of 2d image. For 4 samples, you can use average sampling (what you're doing now) to get the job done. For better techniques, there's Jittered Multisampling, which avoids Moire patterns from more deterministic multisampling algorithms.
Jittered is generated by use of random numbers, though, so probably not too useful on a shader.
 
@ThePhD Is it more "accurate" to use the term "noise"?
 
Sure, I guess.
There's also hundreds of prime, top-quality AA algorithms that work in 4x, 8x, 16, and 32x.
FSAA, MSAA, etc. etc.
 
FXAA
 
8:18 AM
newer shader hardware support a noise() function for generating noise to improve resolution
 
@doug65536 Or to provide the illusion of higher resolution.
 
over time it is more resolution, since it will jitter above approximately the right amount to get an in-between average
 
who's downsampling to provide better resolution? what?
 
seems like andrei is generating mipmaps
 
Nah, I'm just messing around with shaders.
 
8:22 AM
I wish my shaders were working. ;_;
 
I would've thought that there would be more fun things to try than...downsampling :D
 
I'm a very boring person :(
Meh, small drawback - I need to actually add shader support to my sprites.
 
@AndreiTita D2D?
@AndreiTita or SFML?
 
@MarkGarcia SMFL. I just need to add a couple of methods to my data to communicate with its shader wrappers.
 
@sehe nah
 
8:29 AM
@MarkGarcia I like your goose.
It rhymes with moose.
 
morning all
 
mornin'
 
@AndreiTita It's actually a duck. Sorry.
 
@MarkGarcia Ah. It rhymes with fuck then.
 
@AndreiTita So me a fucker. Then... well, okay.
 
8:31 AM
@MarkGarcia You could have pretended it was a goose.
 
I was wondering what you two were smoking, then I took an arrow to the knew refreshed the page
 
I wonder how hash checks on downloads help (except on torrents). If the hashes don't match, then all you can do is to redownload the whole thing!
 
Meh. Warning C4505 can't be silenced. I forgot. My #pragmas, they do nothing.
 
8:37 AM
@MarkGarcia it's more for helping ensure you have downloaded what you thought you where downloading
 
@thecoshman Yeah. But it wouldn't do much help if you've waited for days for a 1 gig download only to find out that it's corrupted.
 
@MarkGarcia better than to try and install that corrupted download?
 
I am now really in favor of download servers supporting torrent protocols.
 
Welll, the shader definitely has a visible effect.
I'm just not sure if it's better or worse.
 
pics
 
8:44 AM
Just a sec, I'm messing around with the params.
 
9:00 AM
well well well
 
Xeo
Mornin'
 
Mawning
 
Mawning
 
Evening
 
Afternoon.
 
9:10 AM
@melak47 Left is my AA (after I managed to make it work like I wanted initially) and right is using SFML's texture smoothing which I'm not exactly sure what it does under the hood, probably bilinear filtering
This is upscaled.
 
Anyway, there's really no point in using my version.
 
stupid language lawyer question: if given a pointer to a POD struct, does it also point to the first member of that struct?
 
user142019
Good evening.
 
@Insilico Cautious yes.
 
Xeo
9:16 AM
Guys... if I do std::sort(c.begin(), c.end(), [](T, T){ return false; }), what order would you expect? (say, with {1, 2, 3, 4})
 
@MarkGarcia you might be able to find a hashes for individual files in the download, but not sure exactly
 
@Xeo Undefined because it's not stable, I think
Ah wait
 
@Xeo {1,2,3,4}?
 
user142019
@Xeo unpredictable.
 
Nope, still undefined.
 
user142019
9:17 AM
You're saying that for every X and Y, X < Y.
 
Xeo
Right, but std::sort doesn't need total order imposed by the comparator.
 
Hm.
 
Xeo
Atleast from what I can see.
@Rapptz That's what I get on every platform / compiler I test it with, yeah.
 
@Zoidberg Nope, he's saying that X is not lower than Y.
 
user142019
You're saying that 1 < 4 and 4 < 1. :P If the sorting algo is not mentioned in the standard, the final order is not defined.
 
user142019
9:18 AM
@AndreiTita ugh yeah but same thing. :P
 
user142019
It may even be UB. I don't know exactly.
 
@Zoidberg It's not UB. std::sort is unstable, so simply the order of elements which are equivalent (i.e. not X<Y and not Y<X) is not guaranteed to be preserved.
 
user142019
Ah okay. :P
 
Xeo
Hm.... for every element !(x < y) && !(y < x), which effectively means all elements are considered equal.
 
In this case I'm guessing the order remained the same because no elements needed to be moved at all.
 
Xeo
9:20 AM
@AndreiTita Right
But to get the same order on every compiler does feel kinda strange.
 
Sure, argument over. (Aside: Lightness is a he; formerly went here by his real name, Tomalak Geret'kal (see blog link in his profile). The profile pic is from a sci-fi TV show, I think.) — Josh Caswell 12 hours ago
THANKS FOR THAT CAPTAIN
 
@Xeo tried a larger sample?
 
Xeo
@AndreiTita up to 50 yesterday, just got to work.
 
@LightnessRacesinOrbit
 
:D
Must find a way to use that tag
 
9:31 AM
13
Q: Why is there a peeking duck in my profile pic?

Mark GarciaIn my SO profile, you may see something odd: a peeking duck. I've just recently uploaded this new profile picture of mine. I checked it after the upload and everything's fine. After a few hours, I opened my profile and there it is, the duck has somehow become afraid of the people viewing it. ...

where is your god now? ^
I wonder what would happen if we tried to namespace windows { #include <windows.h> }
 
Xeo
@BartekBanachewicz bad stuff likely happens.
Never include a header in a namespace.
 
thought that said peeing duck
 
user142019
@BartekBanachewicz Haha cool.
 
user142019
@BartekBanachewicz linker errors, perhaps.
 
user142019
Or other weird shit.
 
9:34 AM
well linker errors I can imagine
I knew it seemed too good to be working
 
user142019
> Implying there is no extern "C" in the header.
 
@BartekBanachewicz Reverse anatidaephobia. voices.yahoo.com/…
 
user142019
Hmm, you know.
 
user142019
I shouldn't define my lexer as a function [Char] -> [Token].
 
So eventually you DID resort to Haskell.
 
user142019
9:37 AM
Huh?
 
user142019
But rather as multiple functions GenParser Char st Token.
 
user142019
And then just call those functions in the parser.
 
Jan 3 at 5:37, by Andrei Tita
Two days from now: "FUCK C. What a terrible language. C is a terrible, unparsable, unimplementable, overly complex, over-engineered, unusable, idiotic piece of junk.
I'm rewriting this compiler in Haskell."
 
user142019
Of course. Haskell is superior.
 
user142019
Who the fuck would implement C# in C.
 
user142019
9:40 AM
Compiler y u no faster.
 
@AndreiTita UB
oh, right, no
 
26 mins ago, by Andrei Tita
@Zoidberg It's not UB. std::sort is unstable, so simply the order of elements which are equivalent (i.e. not X<Y and not Y<X) is not guaranteed to be preserved.
 
what Xeo said
-1
Q: generating Image does not work

Patrik VabererI have a problem that if I change an image on a canvas by clicking on thumbnail and then it should show a button control. It does not work (It should show picture, but it does not). Could anybody identify the problem and fix it? I really have no clue :( Please check the below link for the code w...

 
9:59 AM
@LightnessRacesinOrbit your real name is Tomalak? Do you have pointy ears?
 

« first day (845 days earlier)      last day (4096 days later) »