« first day (523 days earlier)      last day (4418 days later) » 

10:00 PM
Researching...
 
What is a "binary stream"?
 
@FredOverflow Stream opened in binary mode.
 
@FredOverflow I assume a file opened in binary mode
 
It would sound profoundly useless if trying to go to the end of a file was UB.
 
Why would that cause UB?
 
10:00 PM
hmm
 
@FredOverflow There's some quoted article that cites the C standard.
 
Ok, I should actually be researching instead of trying to make a "busy" animation on the ellipsis of that message above.
 
@FredOverflow I can't think of a reason
 
so, const at the end of std::string getValue() function means that getValue() cant modify the object from the class he it belongs?
 
@rogcg correct, and thus that member will work on const objects
 
10:03 PM
Member variables become const.
 
@KerrekSB I can't find the footnote mentioned in the C11 draft.
 
so it says, all the class variables will become const?
 
All it mentions is that it needs not be meaningful.
 
@rogcg const member functions have a const "view" on the member variables. That's all there is to it, really.
 
@rogcg only in that function
 
10:05 PM
so, just to make it clear here, all the variables inside the getValue() method cant be modified, right?
 
They can be modified if you they are declared mutable or if you use const_cast.
 
@rogcg you can modify variables local to the function, just not members of the object itself
 
hmm
 
@rogcg And it only applies to member variables. Not local variables or statics.
 
Ell
hi guys
 
10:07 PM
 
> The keyword this is a prvalue expression whose value is the address of the object for which the function is called. The type of this in a member function of a class X is X*. If the member function is declared const, the type of this is const X*.
@rogcg That's really all there is to it from a callee's perspective.
 
@KerrekSB Ah, found it. It's still the same in C11.
It's weird that this is defined in a footnote though.
 
@rogcg const member functions cannot call non-const member functions on the same object. Frequently it helps to have a const version of a function, and a non-const version with a different return type. (iterator and const_iterator)
 
@RMartinhoFernandes Is it in C99 though?
 
The footnote is from a paragraph that talks about "text and binary wide-oriented streams".
I suppose that doesn't mean compatibility with the puppy's language.
@KerrekSB Yes.
 
10:10 PM
Whoa, I've never heard of that before. That's bizarre.
 
@RMartinhoFernandes lol
 
@RMartinhoFernandes Oh, so it's for wide streams only?
 
That would make sense.
 
10:11 PM
@KerrekSB oh, yeah that does
 
If the wide orientation is set for a stream, you may not be able to move byte-wise and hit a correct wide character.
Though I'm not sure if those "orientations" are part of the standard.
They're a scary, weird global state.
 
@KerrekSB Wide-oriented binary streams makes sense?
> Each stream has an orientation. After a stream is associated with an external file, but before any operations are performed on it, the stream is without orientation. Once a wide character input/output function has been applied to a stream without orientation, the stream becomes a wide-oriented stream.
 
@KerrekSB They come from the C standard, and the C++ standard mentions off-hand that the same rules are in effect for the C++ streams. However, in Windows they're ignored. E.g. documented as not supported for Visual C++.
 
Holy bananas, what is that?
 
10:14 PM
@RMartinhoFernandes Ah, nice.
 
Stream orientations.
 
@RMartinhoFernandes Well, the underlying data would still be in bytes, which is the space in which seek moves around, but the extractable data would be in wide characters. So one could expect certain coherence constraints.
I.e. starting at the front you can move forward one character, but you can't just jump to a random location and expect to be in a meaningful state.
 
> Data read in from a binary stream shall compare equal to the data that were earlier written out to that stream, under the same implementation. Such a stream may, however, have an implementation-defined number of null characters appended to the end of the stream.
WTH is this for?
 
@RMartinhoFernandes filesystems where file sizes must be a multiple of 16 bytes or something? boggle
 
Ah, 7.19.2/5 (7.21.2/5 in C11): "Binary wide-oriented streams have the file-positioning restrictions ascribed to both text and binary streams." @KerrekSB There's your definitive answer. Not based on a footnote.
 
10:18 PM
I need to stop pussying around
 
@RMartinhoFernandes oh, you guys are reading from the C spec. I was baffled, searching all over the C++ standard for anything relevant.
 
allocate some GPU memory, damnit
also, stop pussying with every vertex and index buffer and indexing into it
 
@MooingDuck The C++ standard defers fseek and friends to C.
 
just take the CPU approach and allocate 100000000 different buffers
 
Wait, what?
 
10:19 PM
@RMartinhoFernandes there a link somewhere to a C draft? I should probably have that too
 
> Great things come out of abusing C++. One example is the abuse of templates (which were originally designed to support parametrized data types) to express compile-time computations. The result is Template Metaprogrammming (TMP).
lol
 
@RMartinhoFernandes thanks
 
So, the important question is: does Wide support wide-oriented streams?
@FredOverflow Can I hack some do-notation substitute without major hassles, or crazy syntax? I don't want to nest abused range-fors.
 
@RMartinhoFernandes your C99 draft was published 2007?
 
10:24 PM
@RMartinhoFernandes Hey im trying a new idea to find the indicies ideone.com/ymPbe ... is it reasonable?
 
@RMartinhoFernandes So wait, what are those restrictions? Is seeking to the end UB or not?
 
@MooingDuck It includes fixes.
@KerrekSB On wide-oriented streams, yes.
 
And on narrow streams?
 
@RMartinhoFernandes dunno, I'm not that far into the article yet :)
 
@KerrekSB Can't find anything other than the footnote out-of-context that mentions it.
 
10:25 PM
@RMartinhoFernandes srry i meant this ideone.com/1RFgx :S
 
@FredOverflow your article is blocked for me by my virus protection
"Threat details: Verified fraudulent page or threat source."
 
@MooingDuck Well, "Monads" contains the word "nads", so... probably a dirt-filter at work :)
 
Because text streams can only be fseeked with SEEK_SET, wide-oriented binary streams can only be fseeked with SEEK_SET.
There's no similar restriction for byte-oriented streams.
I guess I could cobble up a debunking answer and post it.
 
@MooingDuck Anyone else have this problem?
 
I don't have an antivirus.
 
10:28 PM
me neither :)
 
@FredOverflow I don't think TrendMicro blocks "nads".
 
ohai
so what did the puppy do?
 
Like clockwork.
 
And I do know my company blocks reddit with a "The connection to www.reddit.com was interrupted.", so it's not our firewall
 
> The idea is that the composition of monadic actions is similar to the compilation of source code: it produces a “program,” which is then “run.”
never seen it that way
 
10:30 PM
@RMartinhoFernandes what?
 
@FredOverflow oh, thats more or less the understanding I got of monads from the Robot
I very nearly typed "Monday" instead of "monad"
 
the monday monad
 
@Beginnernato Look good. You should run some tests (include failure cases, and extreme cases, like needles longer than haystacks, empty needles, empty haystacks, etc) anyway, but it looks like it's on the right path.
@TonyTheLion Someone mentions "nads" and Tony says "ohai". Like clockwork.
 
@RMartinhoFernandes wtf are "nads"?
 
@MooingDuck Woot! I successfully transferred that piece of knowledge.
 
10:32 PM
why the FUCK does this ALWAYS happen to me???
 
See, you even do it without knowing!
It's instinctive!
lol
 
it's not fair
I have been given abilities I never asked for
 
@TonyTheLion use your powers responsibly
 
lulz
@ScottW I'm not proud
 
10:36 PM
Can I name auto modifier in C++ 11 version the analog of var in C#?

In oldest version auto means, that variables are local and developers don't use this in code

now as I understood it will be used often in C++ from 11 version or not?
 
lol]
oh @DeadMG, why is the tagline about you?
did you let out your inner Lion?
 
@user1131997 That sounds roughly right.
 
@TonyTheLion what?
 
> Beware of puppy.
you're puppy, if I'm not mistaken
 
oh
I don't actually know
 
10:39 PM
hmmm
 
@TonyTheLion Just because he's around, so you'd better beware.
 
@RMartinhoFernandes I'm always alert when puppy's around, you never know I might be hungry :P
 
The proof is trivial! Just view the problem as a context-free semigroup whose elements are thrice-differentiable automorphisms.
 
> Since concepts are not part of C++11, we’ll have to rely on programming discipline and hope that, if we make a mistake, the compiler error messages will not be totally horrible.
hehe
 
@RMartinhoFernandes English?
 
10:40 PM
Now I have a math bullshit generator too!
@TonyTheLion Bullshit.
 
for Haskell
The proof is trivial! Just view the problem as a regular monoid whose elements are pointless monoids
 
?
Ah.
Did you make that up, or did it give you that?
 
Went to shop to buy computer mouse today. It seems to be really hard to find good non-wireless mouses these days.
 
@RMartinhoFernandes It gave me that.
 
10:42 PM
lol
 
@StackedCrooked How about a simple Logitech with two buttons and a scroll wheel for 10 bucks?
Also, it's "mice", not "mouses".
 
Oh, of course, pointless is "without points".
I was having trouble seeing how that was related to math.
 
> Just biject it to a bipartite Hilbert space whose elements are structure-preserving Markov chains
 
@RMartinhoFernandes Isn't that actually called "pointfree" though?
 
yes, totally, this
 
10:43 PM
@FredOverflow Couldn't find it. Unless the small laptop mice. But I want a bigger one. Perhaps it was just the shop that had a too limited collection.
 
@FredOverflow Both work.
 
Reddit sometimes has funny questions: nsfw
 
"Pointless" is not just a joke.
In mathematics, pointless topology (also called point-free or pointfree topology) is an approach to topology that avoids mentioning points. The name 'pointless topology' is due to John von Neumann. The ideas of pointless topology are closely related to mereotopologies in which regions (sets) are treated as foundational without explicit reference to underlying point sets. General concepts Traditionally, a topological space consists of a set of points, together with a system of open sets. These open sets with the operations of intersection and union form a lattice with certain properties. ...
 
@FredOverflow Opinions differ. I kind of prefer mouses when referring to computer mouses.
 
@RMartinhoFernandes seems pointless
 
10:47 PM
@TonyTheLion Everything is in the very long term.
 
yea I know my existence is pointless
 
@MooingDuck I think I found the problem...
 
man
those pricks on Gamedev
 
@TonyTheLion I see your point.
 
I ask a perfectly good question, and they make crappy snarky comments
 
10:47 PM
@DeadMG link?
 
4
Q: Implementing invisible bones

DeadMGI suddenly have the feeling that I have absolutely no idea how to implement invisible objects/bones. Right now, I use hardware instancing to store the world matrix of every bone in a vertex buffer, and then send them all to the pipeline. But when dealing with frustrum culling, or having them set...

 
what is the difference between mutex & spinlock?
 
@DeadMG I thought you were a programmer, not a doctor?
 
Spinlock doesn't "release" the thread.
 
10:49 PM
@TonyTheLion Bones is a rendering term.
 
spinlock "spins" (busy waits) the CPU waiting until the thread can enter
should only be used when the waits will be very short
 
> TIL: Porn for the blind exists as a non-profit website. ಠ_ಠ
 
Spinlock consumes 100% CPU usage while waiting for unlock.
 
lol
 
10:51 PM
@user1131997 As a general rule: use mutex.
 
> @Byte56 This question best read by flashlight at a campfire. – K.G. 7 mins ago
lol
I have no idea what's going on, but this is funny.
 
Xeo
0
Q: The new auto-updater for vote counts is really annoying

animusonIt's been confusing me for too long already. Things I've noticed: When there are multiple votes being cast on the same post in succession of each other, it constantly keeps flashing back and forth between a bunch of numbers. I just want to see what the current count is. I really don't care what...

Robot, was this what you were seeing?
 
what's going on is that I'm asking a question and they're just taking the piss :(
 
Anyway, I ended up buying the Microsoft Express Mouse. It's a little odd.
 
thanks
:3038432 thanks
 
10:53 PM
@Xeo Yes!
 
Xeo
Noez
 
I'm +1ing. That thing is annoying.
 
Xeo
My lamp just died right in front of me
While it was on. :<
 
@StackedCrooked No thumb buttons? fail :P
 
@DeadMG Yeah..
 
Xeo
10:54 PM
@Stacked, I demand you change back your Avator. IMMEDIATELY!
 
The promotional text also mentions: "You no longer need to worry about batteries anymore."
Lol.
@Xeo Huh, why?
 
Xeo
Ooh, you had another one in the other messages
 
Woah, that was fast.
 
Is there a standard facility for downcasting unique pointers?
 
dynamic_pointer_cast?
 
Xeo
10:55 PM
Don't think so?
That's only for shared_ptr IIRC
 
@Xeo Ah, it was still the jolly roger with white background?
 
@RMartinhoFernandes No, I thought so too, but it's only for shared pointers.
 
Xeo
Yes
It is still in the small version
lemme refresh
 
Didn't like it either. Prefer this one.
 
Very weird.
 
Xeo
10:56 PM
Now it's jolly roger on flag with blue background
 
@Xeo Same here.
 
Xeo
I DEMAND YOU CHANGE BACK!
 
What? Why?
 
Xeo
People shouldn't just change their avatar!
3
 
@StackedCrooked hmm, this message has the old portrait for me, all the rest have the flag.
 
10:57 PM
> It has long been my belief that most of the conflicts in history were brought about by a indirect result of sexual repression. If everyone was watching porn or at least masturbating once a day, there'd be a lot less fighting.
lol
 
@Xeo Ok, changed it back. Might take a while before it becomes visible after breaking through all layers of caching.
 
Xeo
@StackedCrooked Good boy. :)
 
@StackedCrooked whoa, black background?
 
I guess I'm stuck with this one then.
 
Then I got away with changing my avatar when I did, woot :)
 
10:59 PM
Not this one, but my old one.
 
woof woof
 
Xeo
Okay, it's back
 
I have this duck because sehe made me put it back
 
Xeo
@TonyTheLion You also partly changed your nick. Maybe that helped
 
11:02 PM
Perhaps I should do that. How about VectorizedCrooked?
 
@StackedCrooked AutomaticallyParallellizedCrooked?
 
Apperently 40 hours a week for 3+ months in this room is not enough time to get on the "frequently in room" list. Does AFK count or do you guys not have lives outside of SO?
 
@MooingDuck Both?
 
@DeadMG InfinitelyParallelizableCrooked?
 
that's an ugly way of saying it
 
11:03 PM
@DeadMG ah, I don't AFK here
 
I'd rather have EmbarassinglyParallelCrooked
 
i guess most non-blinded would prefer porn-for-the-blind
xD
 
@DeadMG I like the word "Parallelizable". Mostly because of it's awkwardness
 
true
but you're a peasant :P
 
@DeadMG true enough
 
11:05 PM
I'm here exactly when you guys need me :P
I've probably become a meme in this room
 
we all are
 
The meme is YOU.
 
the grumpy ape, the angry puppy, the historically-memorable robot, the sexually-repressed lion
 
The more I do this the more I hate patching services in windows. I DONT WANT TO RESTART.
...afk... again... :(
 
11:09 PM
ugh fuck windows and it's restart
 
It happed to me a few times that windows suddenly decided to reboot while I was gaming.
 
sorry guys, you insulted Windows and will now have to restart
 
FUCK YOU
 
If you restart then I will throw you off the balcony!
 
11:16 PM
0
A: How to get file size in ANSI C without fseek and ftell?

R. Martinho FernandesThe article claims fseek(stream, 0, SEEK_END) is undefined behaviour by citing an out-of-context footnote. The footnote appears in text dealing with wide-oriented streams, which are streams that the first operation that is performed on them is an operation on wide-characters. This undefined beh...

@KerrekSB I posted an answer.
 
@RMartinhoFernandes Thanks!
 
I'm struggling with the case when char *a = "aardab";
char *b = "ar";
 
What happens in that case?
 
is there a condition that when i set j back to 0, i have it an else
it returns NULL :S
 
Did you try running in a debugger?
 
11:29 PM
I know what wrong .... but i cant think of a condition to make, when to set j back to 0 ... its currently in my else case... where it doesnt do much :S
 
@RMartinhoFernandes around 7 hours ago I told him to get one :/
 
So, what is wrong?
 
@MooingDuck aha sorry .... i had class to go too
 
(Full disclosure: I know what the issue is, and I know how to fix it. I'm trying to see if I can get you to figure it yourself)
 
@RMartinhoFernandes alrite .. kay well soo if a[i] = b[j] then i interate both j and i ...but now i + 1 doesnt equal j + 1 ... so my idea is set j = 0 and check ... but i need to use i++ somehow to make the loop break. but i dont want to use i++.. but instead i want to set j = 0 and see if it equals i +1 :S
 
11:37 PM
It is intended that i+1 doesn't equal j+1 at some point, because the needle can be in the middle.
 
yea ... so now i want to reset j to 0 and start at the same point in "i" .. so i dont iterate i .... but eventually i need to iterate i .... i cant think of a condition to make this so :S
 
Let's see, the expected result is 1, right?
You should really try running in the debugger. Say, the first iteration tests a[0] == b[0], in that case, 'a' == 'a'. So, both i and j get incremented. Then it tests a[1] == b[0], that is, 'a' == 'r', which is false. The else branch is picked, j becomes 0 and i becomes 2. This tests a[2] == b[0].
 
Oh my god
 
Writing down the successive values of variables on paper also works.
 
this account is comedy gold
@SO_QuestionOTD, Internet, Serious Business
SEND ME THE CODEZ
46 tweets, 28 followers, following 1 users
 
11:42 PM
Yes, paper!
I kill trees to write my algorithms.
 
expected result is suppose to be 1 .. but i get -1 so yea ...
you mean b[1] in ur comment right ?
 
Don't you see a problem with testing if a[2] == b[0]?
@Beginnernato Oh, right, sorry.
 
yea i want a check where a[1] == b[0] since they don't equal ..
not a[2] ...
 
Right. That test is already past the solution.
So, what can you think of for fixing that index?
@KonradRudolph Oh my, that's awesome. Followed.
 
will this still go in an else case thou ? :s
 
11:46 PM
Awesome, this question got 97(!!!) upvotes … just for the last sentence.
97
Q: Pass Nothing from Javascript to VBScript in IE9

mixelI have a framework written in VBScript. Inside some function in this framework parameter of the function is checked for Nothing in If statement and then some actions executed. Code that uses framework written in Javascript. So I need to pass Nothing to function to perform some actions. In IE8 and...

 
@Beginnernato It's the else case you have that needs fixing: it's pushing i past the solution.
> Update: Quitted job. Found a better one.
lol
rofl
 
mhm i want to only set j = 0 and not iterate i .... but i need to iterate "i" eventually ?
 
@Beginnernato That happens in the next iteration of the loop, if the characters are equal.
 
yea but if thier not equal ... i will always get the else case and i will never iterate ?
 
11:48 PM
I've never played with variadic templates before. What's the right syntax for this:
template<class ...Ts>
std::ifstream& scan(std::ifstream& in, Ts&... inputs) {
	scan(in, inputs)...;
	return in;
}
or can I not expand that into multiple function calls?
 
You could hack std::initializer_list<int> { (scan(in, inputs), 0)... }, but that's fugly as heck.
 
i need another conditon dont i ?
 
Try it.
@Beginnernato Possibly.
 
@RMartinhoFernandes recursion it is
 
@RMartinhoFernandes Yeah I'd use that.
 
11:51 PM
@RMartinhoFernandes yea that's when im stumped :S
 
@MooingDuck Hint: it looks prettier as a macro.
 
@RMartinhoFernandes I have no idea what I'm doing, I'll test my theory with recursion, I'll make the varadics pretty later.
@RMartinhoFernandes actually, I think I understood that. I'll try that
 
@LucDanton I know, you taught me that.
 
@RMartinhoFernandes wait, I need to guarantee they'll be executed in order.
 
@MooingDuck That is guaranteed for initializer lists.
 
11:55 PM
what about bool isEqual( const Object & ); in this case the object address can only be const values?
 
@RMartinhoFernandes really? wonder why that is. Alright.
@rogcg that's a reference to a const Object
@rogcg all references themselves are inherently const, they can't be reseated.
 
u mean changed
 
@rogcg yes
 
so it passes the address of a const object, right?
 
Aw man, I hate myself.
 
11:58 PM
it's getstate and rdstate? Why not setstate?
 
I got into an argument with someone that believes #includeing a header is undefined behaviour.
@MooingDuck IOStreams don't make sense.
 

« first day (523 days earlier)      last day (4418 days later) »