« first day (402 days earlier)      last day (4560 days later) » 

12:00 AM
I would change it to something else, but I can't think of anything.
A starboard mix would yield: "Masturbation, nukes, shots in the foot, rotting cabbages, children and girls selling coke"
Doesn't look good.
 
room topic changed to Lounge<C++>: Garlic is awesome. [c++] [c++11] [c++-faq]
 
Yes, it does a poor job at advertising.
Onions as well.
 
This solves the problem of both topic and vampires!
 
Are "modern" (i.e. sparkling) vampires affected by garlic?
 
I don't know those sparkling vampires you speak of.
 
12:03 AM
Probably not. They have no weaknesses after all. Aside from being angsty idiots, of course.
 
Nevermind, we don't need protection against pussies.
 
A rocket launcher would probably work wonders.
 
We surely don't.
 
Especially not a cat.
 
user457812
I think napalm works on everything, especially sparkling vampires.
 
12:07 AM
Burninatin' the countryside.
 
And facepalm is good stress relief.
 
Man, I'm so close to 10k.
About 350 rep left.
 
It's a bit soon to fish for pity upvotes.
 
Nah, I don't need your pity. I'm gonna get there all by myself!
And then I'll ask for upvotes.
 
12:12 AM
This binary stuff hurts my brain so much I'm now reading my old PHP code.
 
@CatPlusPlus Nooooo!
 
What?
You still have your old PHP code?
 
Of course. On bitbucket.
 
Is it pretty?
(It's a rhetorical question, I know PHP code isn't supposed to be pretty)
 
It's PHP using 1-space indenting.
 
12:14 AM
I swear I'm having full on crashes/sometimes BSODs like 0.75 times a day on average
 
@CatPlusPlus Oh dear.
 
@KianMayne Nuke Flash.
 
I still think it was pretty good for PHP code.
And first templating engine that didn't suck balls.
 
@RMartinhoFernandes Flash?
 
Ignore me.
 
12:15 AM
It even has documentation.
 
I'm flabbergasted.
 
That's how serious this project was.
 
Shit got real.
 
@CatPlusPlus Was it auto generated?
 
No, Doxygen comments.
 
12:16 AM
@EtiennedeMartel I've been using that phrase every time we learn an important new concept in Physics...as instructed by XKCD
 
@KianMayne I've been using that phrase a lot, considering my English is mostly made of action movie one-liners.
 
@EtiennedeMartel Haha
 
@EtiennedeMartel Yipikaye motherfucker?
 
Nearly half the file is docs!
 
12:18 AM
Ah, I get it now. You wrote docs to avoid writing PHP.
 
Well done.
 
/// <summary>
/// Toes the string.
/// </summary>
public override string ToString()
{
    // whatever
}
This was the result of awesome auto-generated docs.
 
int i = 0; // initializes an int to zero
 
@EtiennedeMartel I like "Toes the string" better.
 
Tip toes.
 
12:19 AM
@RMartinhoFernandes Yes.
Anyway, when you tell a programmer (especially a student) to "comment everything", you get shit like that.
 
What's a better idea - having two buttons and collapsing and showing them alternately
 
@KianMayne What are those two buttons all about?
 
@KianMayne Yes.
 
Or having one button, then changing the content and the handler
 
12:21 AM
My question still stands.
 
One connects, one disconnects
 
Mehhe
The end result will be the same IMO.
 
> JSON encoder (but not decoder) has been replaced with a new one. This one is written in pure Python, but is known to outperform CPython's C extension up to 2 times in some cases. It's about 20 times faster than the one that we had in 1.6.
 
I'd prefer to write the second
 
12:22 AM
PyPy is awesomesauce.
 
Then do it.
 
And in todo.
> Specialized list implementation. There is a branch that implements lists of integers/floats/strings as compactly as array.array. This should drastically improve performance/memory impact of some applications
 
@CatPlusPlus But C is the fastest thing on Earth! Think of the children pointers!
 
Magic dust is faster.
 
I just couldn't stand all those capitals.
 
12:25 AM
MUSHROOM MUSHROOM.
 
I think it's the first time I've seen you yell on this chat.
(Ha, every time I write "chat" I think about Cat)
 
LOUD NOISES.
 
Time for sleep
Night guys
 
See yaaaa
 
12:27 AM
Good night.
0
Q: C Functions: Brian W. Kernighan and Dennis M. Ritchie

Matthew Hoggan If "a funtion" were compiled separately, the mismatch would not be detected, "the function" would return a double that main would treat as an int... In the light of what we have said about how declarations must match definitions this might seems surprising. The reason a mismatch can happen is ...

 
What's a funtion? Is it related to fun?
 
Count me in!
 
Count you in what?
 
YEAAAAAH!
We should always write funtions.
 
12:35 AM
In F# you define functions with the fun keyword.
 
OCaml has that too.
And Erlang.
 
Anyway, it this valid? sum += "the function"(line)?
@CatPlusPlus Yeah, ML syntax.
 
It has function and fun to be more fun.
 
@RMartinhoFernandes Probably not valid C or C++.
 
It's syntactically valid Python, but it'll TypeError.
Okay, sleep time. Buhbye.
 
12:39 AM
I bet it was syntactically valid WideC, at least in some previous incarnation :)
One of those with throw throw throw.
Sleep time for me too. Bye.
 
Good night to you two.
 
12:52 AM
I think what im trying to do makes sense
but it doesnt seem to be working...
Anyone wanna take a gander?
 
user457812
1:09 AM
How would Anyone know if Anyone wants to take a gander?
 
Good point
 
user457812
Anyone already has Noone to deal with, is it important enough that he should take his time away from Noone?
 
Who cares
maybe ill ask him
 
user457812
You are totally ignoring my e.e. cummings joke.
 
I thought you were doing that whos on first baseball joke lol
is that e.e commings?
 
user457812
 
Wanna take a look at the issue im having?
Not specific enough for an SO post
 
user457812
I don't know what issue you're having, since you haven't explained it
 
user457812
So taking a look at anything isn't going to really help, assuming it's something I can help with in the first place and it's something I really care about
 
I have that case 'b' there
and in that case this while loop: while(filmList.checkFor(newItem))
 
user457812
1:17 AM
No, you don't.
 
i dont?
 
user457812
You don't.
 
case('c')
sorry
 
user457812
Why are you explaining this instead of putting in comments?
 
user457812
i.e., a giant comment saying "THIS IS WHAT I SCREWED UP"
 
2:42 AM
@RMartinhoFernandes Unfortunately the only mention of category theory in that article is one final sentence "I will not talk about category theory". Hm. It was a nice-enough article, but once again the necessity to keep the level just below where it belongs ruins a clean exposition.
 
3:05 AM
After much searching and little finding, I decided to start a new question:
0
Q: What is a monad, in categorical terms?

Kerrek SBEvery time someone promises to "explain monads", my interest is piqued, only to be replaced by frustration when the alleged "explanation" is a long list of examples terminated by some off-hand remark that the "mathematical theory" behind the "esoteric ideas" is "too complicated to explain at this...

 
why is that LCS problem is NP-hard?
 
@MrAnubis Are you asking for a philosophical answer?
 
@KerrekSB i am already reading the article on wikipedia , ignore my last post)
 
No problem.
Bear in mind that we don't actually know how hard it is, only that if we can solve LCS, then we can solve lots of other things fast.
 
@KerrekSB Locked it in mind :)
 
 
4 hours later…
7:27 AM
@KerrekSB this about "endofunctor", it sounds like they're talking about rectum functions
 
7:39 AM
isn't monad just a dirty trick to express some procedural control flow?
 
7:52 AM
@AlfPSteinbach it's more about impure functions I thought, which have side effects
 
 
2 hours later…
9:36 AM
guys. ever come across this situation ? stackoverflow.com/questions/8224191/…
 
sounds like int x = 3; write( x ); x = 5; write( x ); why output different values?
good idea to google before asking
 
10:08 AM
thanks.
 
I want to do something nasty
I want to assign the address of a function (ie the hardcoded hex address) to a function pointer
 
Get a girl!
 
is that even possible?
lol
 
Beware that function addresses are liable to change with rebuilds.
 
yea
but in this case I know it doesn't
 
10:17 AM
Ok. I think you can reinterpret_cast it.
 
this is C, not C++
no such thing as reinterpret_cast
:(
 
Oh. Then you only have one type of cast.
 
so I have void (*mypointer)(); and I need to assign it a hex address
I tried to cast the hex to the type of the pointer, but the compiler not happy
 
Hm.
You can probably make the compiler happy with a cast to void* first. But I'm not sure that works fine.
 
mypointer = (void*)0x0012563565 ?
 
10:20 AM
hey guys
 
@RMartinhoFernandes it has to by posix rules, and is not allowed to by c++ rules. not sure about c.
 
@TonyTheLion I was thinking of two casts, but maybe that alone works. And keep in mind that you're in deep implementation-defined territory here.
 
@TonyTheLion are you trying to write some buffer overflow attack to redirect the execution?
 
in c++ functions and data occupy two sides of a fence that cannot be crossed, and void* is on the data side of the fence
i'm guessing maybe that's in support of harvard architecture
 
@MrAnubis no
@AlfPSteinbach so you're saying what I'm trying to do isn't possible?
 
10:26 AM
Without implementation-defined behaviour, it isn't possible.
 
@TonyTheLion how did you get that idea?
 
4 mins ago, by Alf P. Steinbach
@RMartinhoFernandes it has to by posix rules, and is not allowed to by c++ rules. not sure about c.
POSIX requires it to work.
 
@AlfPSteinbach well, that's what I concluded after that last thing
ok
now I just have to find the right way to do it
seems like casting the hex address to void* and then to the type of the pointer doesn't work
 
No idea how the folks do it with dlsym.
 
myfunc_p = (*myfunc_p)(void)((void*)(0x0016a584))
 
10:29 AM
What's myfunc_p?
A typedef to the function pointer type?
 
no the function pointer type itself
void (*myfunc_p)(void);
 
Oh, then you need to ditch the variable name from the cast!
And add the parenthesis around the function pointer type, to make it a cast.
   /* Writing: cosine = (double (*)(double)) dlsym(handle, "cos");
       would seem more natural, but the C99 standard leaves
       casting from "void *" to a function pointer undefined.
       The assignment used below is the POSIX.1-2003 (Technical
       Corrigendum 1) workaround; see the Rationale for the
       POSIX specification of dlsym(). */

   *(void **) (&cosine) = dlsym(handle, "cos");
dlsym returns a void*.
God, that looks ugly.
 
myfunc_p = ((*)(void)((void*)(0x0016a584)));
like so?
 
(void(*)(void)) (void*) 0xblah
 
@RMartinhoFernandes (void ())(void*)(0x0016a584) -> wont work also?
 
10:33 AM
I don't know what would work!
I'm just spewing valid syntax.
Apparently POSIX takes a very roundabout way to do this.
They declare the function pointer first: double (*cosine)(double);
And then they cast that function pointer variable to void*, instead of casting a void* to a function pointer.
To cast that function pointer variable to void* they go around by taking it's address, casting to void** and then dereferencing that once.
Once you have done this rigamarole, you assign your void* into that result.
This does it without invoking any UB, but it's still implementation-defined because pointer sizes need to be the same and all that.
 
thanks :)
 
If I had to do this, I'd ask my coworkers/look around the code how do they do it.
 
@awoodland Are you around?
 
11:30 AM
@EddyPronk - am now
 
@EddyPronk - that's ok, did it solve the issue in the end?
 
I learned a lot about the enum <=> int conversions.
I knew enums are very limited in terms of type safety.
I would like to have that warning implemented in GCC.
Looking in the sources now to see where the switch related warnings live.
I'm not sure if the original type of the enum is even available in the context of a switch label.
 
@EddyPronk - I'm not 100% sure, but it might be easier to hack as a clang plugin
 
Hi! It's annoying that correct answers doesn't get accepted... is there anything to do to push the asker to accept answers?
 
11:37 AM
I should consider looking at that indeed.
 
@EddyPronk I think it'd be one of those cases where the signal to noise ratio on it is so poor it's basically useless though
@AndreasWederbrand I think that's considered bad form generally. Users do come back and accept things long after the question was asked quite often though
 
right, I'll wait :)
 
I'm not interested in all conversions, just about the specific switch on a color and have labels that don't match.
 
@EddyPronk gcc with -Wall -Wextra gives you a warning if you're missing a label from an enum, but it doesn't warn about extra ones
 
When it's a new user, and posts a comment like "Great! That solved it!" I usually point out to them how accepting an answer works (link to the FAQ). Otherwise I assume they know how the site works.
 
11:40 AM
My question had 2 down votes and 2 close votes and a nice question badge. :)
 
@EddyPronk I only see 1 down vote and 1 close vote
 
@awoodland You're right. I looked 2 days ago.
 
@EddyPronk that probably means the first two close votes expired and another one has been added since
 
-W conversion is one that generates a lot of noise. gcc.gnu.org/wiki/NewWconversion#Frequently_Asked_Questions
"it shouldn't be enabled if it is not explicitly requested. "
 
@EddyPronk for the last example I get test.cc:8:10: warning: enumeration value ‘Green’ not handled in switch (and the same for Red) with -Wall -Wextra which is basically what you're looking for, just no warning about the extra ones
 
11:49 AM
That's the one with Banana = 0x3 right
That works if the values are unique across different enums.
 
or if there's another way of producing valid values
 
meaning?
You mean number qualify?
To check if the nodes in gcc are rich enough to find the type I probably need to build a debug version of gcc to explore. Not sure my 2Gb laptop can do the job.
 
why is the restriction on 2 dim array that 2nd dim has to be const even when allocating on heap?
 
@EddyPronk I built a new version of clang on my atom netbook the other day. It's not too painful, took roughly the length of my lunch break IIRC
 
Basically T[][] is useless.
 
11:58 AM
new int [var][has_to_const];
@RMartinhoFernandes why so?
 
You can't meaningfully index into it without knowing all but one dimension.
 
@MrAnubis I think the opposite question is useful - what would you like the memory layout to be if you could do that?
 
@awoodland sequential?
 
And how would the compiler know where x[1][3] is?
It needs to know the size of the second dimension to know where x[1] starts.
 
(x+1*3+3) ?
 
12:01 PM
@MrAnubis What if the second dimension has size 500?
 
sec
allocation failure occurs ?
 
Ok, lemme rephrase my question. Given int x[][]; // no dimensions known, if you write x[1][3], where is this element?
 
@RMartinhoFernandes no way to know then since we need to know size of x[]
 
Right. And that's why when you have multi-dimensional arrays you can only omit the first dimension.
 
aah , now got it , thanks
 
12:05 PM
Of course this could be done at runtime, but that's just not how C arrays work.
 
@RMartinhoFernandes at runtime? generating instruction for *(array+x*y+offset) ? for array [x][offset] , right?
i am bit confused , pardon me
 
@MrAnubis You could create a array2d class that stored the dimensions and then provided a suitable operator[] that took advantage of that knowledge to index manually into a 1d array.
 
@RMartinhoFernandes that seems best way if want to stick to c array or use vector :)
 
Right, vector is better.
 
you're awesome Mr.Robot™ :)
 
12:48 PM
how long can a blog post reasonably be, when it's about c++?
 
If you think it's too long, make a series!
 
Well the HTML is at line 563 now, and I'm about to add a lot?
 
make it as long as it needs to be
dont follow the twitter crap
 
If you make it a series, you can get feedback on the first part before you post the second.
Also, it makes your blog look more busy.
 
yes, i haven't posted in a year or so
here's the TOC so far of the potential new posting:
<ul style="list-style-type: none; list-style-image: none; ">
    <li><a href="#intro">Introduction</a></li>
    <li><a href="#linux_approach">How the Linux &ldquo;all UTF-8&rdquo; approach does not work in Windows</a></li>
    <li><a href="#about_direct_io">About direct console i/o</a></li>
    <li><a href="#portable_source_code">Portable source code should be UTF-8 with BOM</a></li>
    <li><a href="#utf8_mode">The Visual C++ UTF-8 stream mode</a></li>
    <li><a href="#utf8_mode_output">UTF-8 stream mode: the good (wide stream output)</a></li>
It's about console i/o in Windows he he
I covered the good and half the bad, so now i'm about to do the rest of the bad, plus the ugly
 
12:53 PM
Damn, you answered before I asked.
 
Bah, my preprocessor needs to ignore BOMs. It's always something. Are they supposed to only occur at the very beginning of the file?
 
yes
although since it is technically a zero width space can be ignored anywhere
 
Isn't it supposed to be an invalid character?
 
does anyone have any kind of experience with Windows UAC/privilege elevation stuff?
 
Oh, no, it's allowed in the middle.
 
12:55 PM
Okay, anywhere is easier :v) . Actually isn't zero width space a valid identifier character? That would be troublesome… looking this up…
 
"If the BOM character appears in the middle of a data stream, Unicode says it should be interpreted as a "zero-width non-breaking space" (essentially a null character). In Unicode 3.2, this usage is deprecated in favour of the "Word Joiner" character, U+2060.[1] This allows U+FEFF to be only used as a BOM." - Wikipedia
 
Ah, deprecated.
 
@jalf I found out how to tweak registry so I could take a screendump of the dialog. But I don't remember how.
 
Yeah, \uFEFF is a valid identifier, and so is \u2060. WTF?
 
well, I need to start a process with elevated privileges, and calling ShellExecute with the runas verb, which seems to be the normal way to do it, seems to clear the process' environment, so some stuff is missing from the path, and it can't find a bunch of dlls...
 
12:59 PM
@AlfPSteinbach Let us know when you post that, I am curious to read it. I pretty much never do windows stuff and have never messed with UTF explicitly.
 
wchar_t \uFEFF = '\uFEFF', \u2060 = '\u2060';
 
@RMartinhoFernandes That new Mote book is only $2.65 on google books...I wonder if that means anything
@RMartinhoFernandes did you read the second one? Amazon calls it "adequate but inconsequential".
 
Judging from reviews the second one is bad. I never read it.
That third one is from Pournelle's daughter and is self-published.
I'm not going to shell out the money for them.
 
@RMartinhoFernandes I just bought the first one based on our conversation the other day, if I don't like it you will be punished...with bad SO questions.
 
Oh, the first one is awesome.
And it ends, so you don't need any sequels for closure.
If you don't like it, you should be the one punished :P
 
1:12 PM
That's the worst thing about many books...especially in today's age.
...and movies too.
I will have to figure out where in the world Portugal is and then come and beat you for your insolence.
 
I think you guys have a base at Azores.
That's Portugal!
(But I live on the mainland.)
 
sbi
I am currently in the planning stages of a hangover.
 
Sounds fun.
 
I guess I should have known that Portugal owned them but I didn't. Stupid american.
 
sbi
> This is what happens if you leave things on your desk at Double Fine...
 
1:16 PM
"Image not found"?
 
sbi
@RMartinhoFernandes Mhmm. It's found here.
 
I get redirected into a strange XML file:
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>2348058A18CD4319</RequestId><HostId>jFg0755AybCDkCenBJ/ukHucuKn7qJPlA4cv357IfLLxw39FvSG7oP4nm8YoC0Tb</HostId></Error>
 
@sbi stupid art team
@RMartinhoFernandes Portugal has censored you from viewing questionable "art".
 
sbi
Oh, I killed the conversation. :(
Well, back to work then...
 
@RMartinhoFernandes I also bought the Haskell book. I hope the dude who wrote it actually makes money off that.
 
1:28 PM
> Not all performance considerations are premature optimization!
I like this.
 
0
Q: Is the byte order marker really a valid identifier?

PotatoswatterC++11 makes numerous additions to the list of Unicode code points allowed in identifiers (§E). This includes the byte order mark, which is included in range FE47-FFFD. Consulting a character browser, this range includes a whole bunch of random stuff, beginning between WHITE SESAME DOT and PRESE...

 
The replacement character is a valid identifier?
Wow.
 
^ tone of outrage is a bit overstated, but good for lulz.
They added features specifically for obfuscation. But they also decided to be the Sesame Nazis.
 
@Potatoswatter that is retarded
 
hey
 
1:37 PM
Seriously though, they felt there was a need to help obfuscate in the standard? I guess I get it, but wow.
 
can anyone point me in the right direction? I have a thread that listens on a port and dispatches handler threads for incoming connections (those threads do the real work which might take anywhere from a few seconds to a few minutes). What is a good way to gracefully close the app? I dont mind worker threads to be stopped, the only thing is that they need to be stopped gracefully (stop work, save intermediate results, exit).
 
Add interruption points to the workers?
 
What do you mean by interruption points? Slow closing is fine (if slow means a few seconds at most)
 
Saving intermediate results rules out fast closes. Might not even bother implementing interruption at all except for the tasks longer than a few seconds.
 
1:44 PM
You add regular explicit checks in the long tasks to test if it's time to bail out.
 
well most task will take minutes.. some even hours.
 
> If you still don't know what recursion is, read this sentence.
 
What sort of application is this? On most systems that can go to sleep like that, the OS handles the work. I've never heard of a server that could resume a suspended task.
 
currently what i am thinking is a global worker counter and a run flag guarded by a critical section... each worker will check the run flag from time to time and if set to false, gracefully quit and decrement the worker counter. Listener quits when worker counter reaches zero.
 
Right, that's what I meant by interruption points.
 
1:50 PM
@Potatoswatter a very specific kind of server. Actually the task istelf in this case is just a connection between the server and a client where the client submits queries and the server answers. The connection is permanent, thus it may take hours till the client asks all the questions it has. So replace "save intermediate results" with "needs to inform the client that it is exiting" and it should be clear :)
 
The counter should be guarded by the critical section, not the run flag. It will see a lot of contention.
 
@RMartinhoFernandes great, thanks.
@Potatoswatter you are right, I messed it up.
 
Oh, OK.
 
thanks for the help, glad my thoughts weren't totally wrong.
 
Beware of blocking calls, though. If a worker is blocked on some operation, it won't be checking any flags.
 
1:54 PM
ok, will do.
 
There may be some platform-specific trick to force any given I/O operation to abort, such as sending a message to your own port.
 
> Congratulations! As you are spending £10 or more we are pleased to give you a £2 MP3 voucher to spend on any MP3 album with Amazon MP3.
Turns out this is only usable from an UK IP.
If this is giftable, I don't mind giving it to someone else, since I won't be able to use it.
 

« first day (402 days earlier)      last day (4560 days later) »