« first day (468 days earlier)      last day (4471 days later) » 

12:00 AM
@KerrekSB Well tuples aren't terribly sexy and certainly don't feel modern or new. But they are really convenient, yeah :)
 
Xeo
I'll just build it again
 
Now, to distribute this stuff around the filesystem...
 
wait, fixedPoint.h:172:0: warning: ignoring #pragma gcc diagnostic. why would it do that?
 
Xeo
> + clang++ -c -g -Os -fPIC -std=c++0x -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion -Wnewline-eof -Wpadded -Wmissing-prototypes -Wstrict-aliasing=2 -Wstrict-overflow=4 -nostdinc++ -I../include [name of cpp here]
 
Because it's MSVC?
Just guessing.
 
Xeo
12:00 AM
That's the invokation
So it does use clang++
 
Yeah, that's the same.
 
Xeo
Ohh, I get an error now too
 
Ha!
On future?
 
Xeo
Seems my last build indeed didn't have proper scoped enum semantics
Aye
 
And there are a few narrowing conversions on locale.cpp too.
 
Xeo
12:02 AM
Yeah
And the missing exception_ptr stuff
 
Ok, where do I send the patches to?
 
Xeo
Omg
That thing builds all the .cpps again after an error -.-
 
@RMartinhoFernandes ah got it, GCC must be capitalized
 
It builds fast.
 
Xeo
Not for me :P
 
12:03 AM
@SethCarnegie "Applications with multiple threads can include a message loop in each thread that creates a window. "
 
Xeo
Man, symlinks really are convenient
 
@TonyTheLion yes I know that you can have multiple GUI threads, but if one does SendMessage on a window that was created on another thread, will SendMessage block while the WndProc is executing in the thread the window was created in, or will it block while the WndProc is executing in the thread that called SendMessage?
 
Xeo
NOES
Clang ICEd on me
 
hehe.
Show it!
 
Xeo
12:06 AM
So, anything else I should know?
 
@SethCarnegie well, the link I gave has lots of info, I'm sure the answer will be there somewhere.
I honestly don't know
 
Xeo
clang: /home/xeo/llvm/include/llvm/ADT/OwningPtr.h:34: llvm::OwningPtr<T>::OwningPtr(const llvm::OwningPtr<T>&) [with T = llvm::UndefValue]: Assertion `RHS.Ptr == 0 && "Only null OwningPtr's are copyable!"' failed.
 
Xeo
In locale.cpp with a slew of thousand warnings beforehand
 
Mine compiled fine.
 
12:07 AM
For all everyone claims that GCC is superior to MSVC, it sure gives useless warnings.
 
Xeo
:|
 
Both clang and libc++ are fresh from today.
 
Xeo
Did you change anything else?
 
@MooingDuck Which one? GCC?
@Xeo Nope.
I'm sending a patch now.
 
Xeo
Grr. Why doesn't it build...
 
12:08 AM
@RMartinhoFernandes yeah. I'm trying to specialize std::numeric_limits, but it's telling me std::numeric_limits is not a template.
 
Are WM_USER messages queued or nonqueued messages?
 
You're probably doing something wrong.
 
Xeo
Btw @RMartinhoFernandes, you should hack the <__config> header
 
@RMartinhoFernandes I think the point is that it's not clear that the wrong part is :p
 
Xeo
To enable constexpr
 
12:09 AM
@Xeo Oh, tell me more.
 
Xeo
line 234
 
Xeo
Yeah
Simply comment it out
 
My GCC error <-> 'wtf am i doing' internal map is suggesting that possibly an include is missing, or the syntax for the specialization is wrong (meaning template<...stuff...>, angle brackets, and terminating semicolon).
 
Building again.
 
12:10 AM
@SethCarnegie About SendMessage: " The function waits until the window procedure completes processing and then returns the message result."
 
Xeo
no need
 
@Xeo Checking for errors or something.
Boatload of warnings, no errors. Nice.
 
@TonyTheLion but how does it wait? Does the OS hold it up until the other thread is done or does it call the wndproc in the thread that called SendMessage?
 
@SethCarnegie What's an "unqueued" message?
 
@SethCarnegie A thread that calls the SendMessage function to send a message to another thread cannot continue executing until the window procedure that receives the message returns. If the receiving thread yields control while processing the message, the sending thread cannot continue executing, because it is waiting for SendMessage to return.
straight from MSDN
 
Well, then, there's your answer, SendMessage skips the queue.
 
Hmm, how should I create a testcase for this?
 
Well that was a separate question
 
Xeo
@RMartinhoFernandes For the scoped enum thingy?
 
12:13 AM
under the Deadlocks section
 
I still have the question about what thread the wndproc is in, I don't really get it from @TonyTheLion's quote
ok I'll read that
 
@Xeo Yeah. I'm not supposed to be testing clang, but the "buildability" of libc++...
 
@SethCarnegie Sendmessage is sent from thread A and WndProc is in Thread B
 
Xeo
Man, it bugs me that Clang is ICEing
 
as long as thread B hasn't returned, thread A is blocked on SendMessage
 
12:14 AM
@TonyTheLion ok that's perfect then
 
@Xeo How old is your build?
 
Xeo
@RMartinhoFernandes 2 days?
 
@RMartinhoFernandes included "limits" rather than <climits>
 
So it should be safe to write to non-thread-safe variables associated with an HWND inside the HWND's WndProc without a critical section, right?
 
@SethCarnegie do read that article though, make sure you really get it, its important in threading
 
12:15 AM
@MooingDuck Which compiler has the useless warnings again?
@TonyTheLion Sorry, but I'm not interested right now :P
 
sorry, wrong person
 
@MooingDuck So then numeric_limits wasn't a template name :p
 
I will
 
@SethCarnegie well, if the other thread, from which you're sending the message, isn't doing anything to the variables
 
@LucDanton and as it turns out, <climits> is also the wrong header. or something. Because I still get the error. Same with <limits>
 
12:16 AM
@TonyTheLion yeah, it doesn't have access to them
@TonyTheLion actually it doesn't matter because it can't be doing anything at the same time, no?
 
though, because the sendmessage thread blocks on send, it can't really do anything while B is responding to sendmessage, so I guess anything done at that time, should be fine without a mutex
 
because SendMessage makes sure only one is running at once
yeah that's what I was getting at
 
Brilliant, thanks, I'll go upvote one of your answers :)
 
oh thanks :)
 
12:17 AM
@MooingDuck Specialization works fine using <limits> here :/
 
@LucDanton I can't read. The errors I got with <limits> were completely different. Turns out I need <limits> and <climits>. Heck if I know what I'm doing.
 
hi guys, what would be the most efficient data structure to put behind a priority queue? (considering I need very fast inserts, very fast search for the highest-ranked element, and okay-fast popping of that element)
 
Or at least error messages.
There are people here with brains fine-tuned to decypher GCC messages. You should take advantage of that.
 
@zneak traditionally priority queues are implemented with heaps
 
12:20 AM
@zneak Sounds like a min-heap.
 
@zneak highest ranked element search is O(1), inserts are O(log n) IIRC, popping is O(log n)
 
@zneak std::priority_queue<std::vector>
 
Yesterday it rained.
 
@SethCarnegie popping is O(log n)
 
@RMartinhoFernandes yeah just corrected it, misremembred
 
12:21 AM
lol
 
yeah
huh
 
Ah, fuck this. I'm sure Howard will notice and fix this ASAP. It's not hard to fix.
 
java's priority queue is implemented with a heap and it didn't feel like it was 'very fast' with inserts, but that might just be the java factor
 
@Xeo hmm, can't link a Hello world with libc++ :(
 
@zneak it could be that your heap is turning into a linked list by the way you're inserting elements turning it into O(n) time to insert
 
12:33 AM
Heaps don't suffer from that.
Heap invariants guarantee that it's always a balanced tree.
 
Ah ok
 
wait, -Wno-div-by-zero disables the warning? gcc.gnu.org/onlinedocs/gcc/…. That's counterintuitive
 
Xeo
@RMartinhoFernandes Huh?
Did you correctly place the .so?
 
@MooingDuck All flags prefixed by no disable warnings.
@Xeo Yep, it's right next to libstdc++.
 
@MooingDuck What would you expect it to do? Disable division by zero?
 
12:40 AM
[rmf@aarika ~]$ ls /usr/lib/lib{std,}c++*
/usr/lib/libc++.so    /usr/lib/libc++.so.1.0  /usr/lib/libstdc++.so    /usr/lib/libstdc++.so.6.0.16
/usr/lib/libc++.so.1  /usr/lib/libstdc++.a    /usr/lib/libstdc++.so.6
 
@CatPlusPlus I had it in a diagnostic pragma to disable the warning
 
Xeo
Hm, that should work
01:41:13 $ ls /usr/lib/lib{std,}c++*
/usr/lib/libc++.so    /usr/lib/libc++.so.1.0   /usr/lib/libstdc++.so.6.0.13
/usr/lib/libc++.so.1  /usr/lib/libstdc++.so.6
 
Xeo
@DeadMG no.
 
// TODO: Remember what went here
 
12:41 AM
OMG 200s!
@Xeo Can you compile a hello world with -v and get me the linker command-line so I can compare?
 
@MooingDuck Many empty sections :P
 
Xeo
Uhm.. try it?
 
Xeo
The invokation
Oh, I
nvm :D
 
Xeo
12:45 AM
Too long. -.-
 
I'm only interested in the part that starts with /..../ld
 
Xeo
That's it
 
Ah, you got it.
Hmm, seems the same except for the architecture parts (I'm on 32-bit).
(Also, fucking ../.. in the middle of paths... Can't they collapse that shit?)
 
Xeo
:/
 
hmm, google calculator doesn't like doing mod with large numbers
 
heh, excel doesn't either
 
"/usr/bin/ld: a.o: undefined reference to symbol '__cxa_begin_catch@@CXXABI_1.3'" fsck.
 
@RMartinhoFernandes hmm, wolfram makes it tricky to highlight results. They have a copy plaintext button though, good enough
 
Sounds like an ABI incompatibility somewhere.
@MooingDuck Yeah, that's a bit annoying... But they have the best mathing tools available.
 
12:57 AM
@Xeo Thanks!
-lsupc++ fixes it.
I wonder if I can make this part of the default linker command-line.
 
Xeo
That said, I don't have any problems with that. Seems I build it with libstdc++
 
Hmm, lemme test that...
 
hey guys
someone upvote my answer on Programmers so I can get that 50 upvotes badge
49
A: Never use Strings in Java?

DeadMGEncapsulation is there to protect your program against change. Is the representation of a Name going to change? If not, then you're wasting your time and YAGNI applies. Edit: I've read the blog post and he has a fundamentally good idea. The problem is that he's scaled it way too far. Something l...

 
Xeo
There is no 50 one IIRC
only 40
 
oh
 
1:01 AM
There's a 50 votes badge?
 
well that doesn't make much sense
 
It's at 100.
 
oh, it's 10, 25, 100
I thought it was 25, 50, 100
oh well
 
Gareth Gobulcoque, lol
 
it's Yahtzee
 
1:03 AM
Yahtzee?
 
zero punctuation
 
our tastes in games don't line up that great, but the guy sure can make me laugh
 
hmmm, shouldn't (unsigned)(rand())*UINT_MAX result in 0 always? In my code I'm getting a non-zero.
 
no, why would it?
 
1:07 AM
because it would always be a multiple of UINT_MAX, and all arithmetic is modulo... ah. it's modulo UINT_MAX+1. Got it.
 
unsigned is modular on UINT_MAX+1 (i.e. 2^32), not UINT_MAX (2^32 -1).
 
TOO WHITE AND NERDY
 
oh. Maybe my code is working then :/ And has been for hours.
 
know pi to a thousand places
 
1:08 AM
Debugging imaginary bugs is great.
 
@DeadMG I only know ~14. Which seems common for programmers
 
@DeadMG that looks like flight of the conchords. vaguely
 
*ck - just wasted a day caused by mixing boost's memory pools with std::unique_ptr - luckily good ol' valgrind caught the anomaly, as usual...

...going to have to sweep through the entire code base to enforce some kind consistency (gotta make it obvious when I'm using one memory model or the other - or even better - if I can cause some enforcement by using static_assert() or some other build-based checks, that would be even better)
 
it's teh awesums
 
1:12 AM
I have to make my policies clearer as the project gets bigger (up to 44kloc now)
 
Hmm, bad things.
> a.cpp:1:10: fatal error: 'iostream' file not found
 
ouchies
 
Xeo
clang instead of clang++?
 
clang++ -stdlib=libc++
 
Xeo
ls /usr/include/c++/ please
 
1:15 AM
Lemme double check where I placed these...
Oh wait, what am I smoking...
 
Xeo
Your cables
 
@sehe, no I mistyped it. ;)
 
Damn, didn't work.
 
what didn't work? @RMartinhoFernandes
Did anyone of you coded in AS?
 
What's AS?
 
1:21 AM
I'm doing it right now, and it's so same to Java.
ActionScript
I thought this would be harsh, but now I enjoy it. :)
just I am a little new to CS5
so I will have to ask some Q.
 
@Xeo Nah, building libc++ with clang++ -stdlib=libstdc++ didn't work :(
 
Xeo
Hm
 
hmmm
for an arbitrary-size integer, what should be the interface?
 
+, -, etc?
 
got that far
construction, assignment, and conversion to a ranged integer
 
1:28 AM
Ah, whatever, I can live with one more flag in my alias.
 
Do the Win32 thread functions such as GetCurrentThreadId() etc. work even if you don't use the Win32 CreateThread functions, but instead use some third party library
 
of course they do
 
Well I mean, do they work as intended
 
there is no way to implement hardware threads without, ultimately, going to the operating system and asking for them
 
Alright, thanks
So any threading library is basically a wrapper around the OS specific calls, nothing more
 
1:30 AM
Or implements userspace threads.
 
And in that case would GetCurrentThreadId and stuff work properly?
 
I'm pretty sure that on x86, you can't implement threads in user-space
 
Ruby did that (not sure if it's still true).
 
they probably said "threads" and meant "co-routines" as opposed to actual hardware threads
 
Userspace threads are not hardware threads, obviously.
 
1:33 AM
then that's not an actual thread
 
Debatable.
(Wikipedia agrees with me, not that it matters much).
 
well
 
Why aren't userspace threads actual threads?
 
does your application gain significant performance? no
do you have to synchronize shared state? no
 
Yes you do!
 
1:34 AM
I used Lua's co-routines extensively, and they had no such requirement
and since they are not hardware threads, why would you have to synchronize them? their execution cannot be interleaved
 
Yes it can.
 
oh, I'm sorry
 
Sure, their execution can be interleaved. Isn't that a major responsibility of the operating system?
 
"at any level that actually matters in terms of synchronization"
 
@Maxpm Userspace threads are not managed by the OS.
@DeadMG I have no idea what that means.
 
1:37 AM
well, the Ruby runtime isn't going to be dumb enough to stop a user-space thread from executing when it's, say, in the middle of mutating a string object
 
But it can do it in the middle of an operation that involves several steps.
 
So if I have a simple, single-core processor running a multithreaded application, each thread will begin execution only after the previous stops?
 
so they pre-empted you instead of co-operative?
that's insanity
why on earth would you have the massive headache of synchronization without the performance benefits that hardware threads bring?
 
No, they're cooperative, but there are lots of calls that can cause a switch.
 
arguably, that's effectively the same thing
 
1:39 AM
Stuff that would normally block, for example.
 
fundamentally, threads are about performance
if your threading system doesn't offer the performance improvements of hardware parallelism, then it's junk
 
Guess what, Ruby's did (not that Ruby was ever anything close to "fast", but well...)
 
I never said that it was impossible to do or even that nobody had done it
merely that it would render such a system "junk"
I mean, if there's no performance improvement, why add all that development difficulty
 
But who said there's no performance improvement?
 
@DeadMG I disagree. They can be about performance, and they often are, but they are also often about, say, doing something in the background while the user interface remains responsive.
 
1:43 AM
Obviously it's not the same, but it's not "no performance improvement".
 
well, you're not using hardware threads, so you only have one core to play with
 
Yes, and if you have I/O bound stuff, you can play with it just fine.
 
so whereas a not-userspace-thread program can use 100% of one core, a userspace-thread program can use 100% of one core but minus a bunch for synchronization
 
Xeo
So, robot, still problems with your Clang build?
 
@RMartinhoFernandes You can't do asynchronous I/O without hardware threading
 
1:45 AM
Speaking about threading, I'd like to spawn a parallel discussion:
 
I think you could do async-IO with UNIX signals (since before there were threads)
 
@DeadMG You mean without multiple cores?
 
Where do you think computer science fits into the academic spectrum? That is, is it actually a science?
 
You can do asynchronous I/O on a single hardware thread just dandy.
People did it for years.
 
no, because what's going to happen when the I/O returns?
oh wait, switch to the new thread
unless you polled it for eternity instead of event-based, I guess? but that event can still only be set by an external thread
 
1:47 AM
@DeadMG A signal handler will run, for example.
 
right
it's called by the kernel, which is in another thread
 
No.
This works on single-core systems.
 
cores != threads
a pre-emptive OS can run plenty of threads on a single CPU core
 
Well, it works on a single hardware thread.
 
no it doesn't, the kernel thread is just managed for you by the operating system
 
1:49 AM
What hardware-threading support does a single-CPU core offer?
 
fundamentally, the OS cannot use less than two threads, because there's nothing to say that your thread is in any state to call that signal handler
 
before there were even threads (in the days where there were only processes), you could have async-io just by using UNIX signals and interrupts... ...of course, your system isn't parallel, in the sense that a multi-core threading system is, but from the program's POV, it looks the same
 
they would have to call it from a second hardware thread, suspend primary thread
@Maxpm You can still create and execute multiple threads per process. They just always happen to get scheduled on the same core.
 
@DeadMG Right... And isn't that what the OS/scheduler does? Takes a process's threads and sets up a linear order for them?
 
@Maxpm It can set up whatever order it likes for them.
 
1:52 AM
@DeadMG Right. The point is, it manages to fit them into a CPU that can only do one thing at once.
Now, how is that not userspace threading?
 
because the kernel handles it?
userspace and kernelspace != hardware parallelism
 
With what?
Interrupts, right?
 
As opposed to what? The language runtime?
 
Userspace uses signals instead.
And builds the same crap on top of that.
It's painful, it's not as good, but it's not worthless.
 
there's a big difference between hardware threads, even on a single-core system, and userspace threads
for example, hardware threads can be interleaved between processes
quite importantly, hardware threads can yield to the operating system or other processes whilst waiting
userspace threads cannot
 
1:55 AM
What, exactly, were we talking about that spawned (ha) this discussion?
Something about Ruby?
 
And that makes them immediately useless?
 
well, yes
you have all the headaches of synchronization and none of the benefits
 
But you fucking have benefits.
People have been reaping them.
 
the only example you've given is arranged in kernel space
 
No, it's not!
 
1:57 AM
@Maxpm I asked if GetCurrentThreadId works in threading libraries that don't use CreateThread
 
If one Ruby thread does a system call everything hangs.
 
if you call ReadFile, then it blocks
 
A long time ago
 
There is a reason for that.
 
the only way to get asynchronous I/O on Windows is to ask Windows to do it for you
 
1:57 AM
Because the Ruby threads are not managed by the kernel.
The interpreter never calls CreateThread or equivalent.
 

« first day (468 days earlier)      last day (4471 days later) »