« first day (563 days earlier)      last day (4389 days later) » 

3:07 PM
@Mysticial did some kid just die from falling off that mech
 
Fuck me, John Carmack answered!
15
7
Q: Transatlantic ping faster than sending a pixel to the screen?

Konrad RudolphJohn Carmack tweeted, I can send an IP packet to Europe faster than I can send a pixel to the screen. How f’d up is that? And if this weren’t John Carmack, I’d file it under “the interwebs being silly”. But this is John Carmack. How can this be true? To avoid discussions about what exact...

 
@SethCarnegie ???
 
@Mysticial bokurano episode 2
 
@SethCarnegie Watch another episode. :)
 
@KonradRudolph: he must have seen that you are ranked in 9th position on that guy's SO/twitter rank page
 
3:10 PM
Wins battle goes outside mech to bask in victory DIES
@Mysticial the next episode is at 98.8% and has been for a while so I'm annoyed
 
@sehe Sure, of course. Because that’s the first resource to assess whether to answer a question. :p
 
ah, 100% :D
 
lol
 
also, the list is very out of date
wow, his answer is awesome
 
wow... look at the flags...
lol
 
3:13 PM
dumb
 
@KonradRudolph just wanted to link you to it and happened to see your message right at that time
 
Somebody asks a question. And then pings everyone in the room.
 
I wonder why he bothered with the linebreaks in there. It would seem less inconvenient to put all @pingables @on @one @line
@KonradRudolph quite solid stuff. He signed up just to answer :
 
@KonradRudolph OMFG he made an account to answer that question! o_O
 
3:16 PM
O_o
 
and it’s really him, as proven by a tweet made by him about it to @Xeo
well, my work for today is done :)
 
woah... I just saw that answer.
 
Dat guy's mad ^^
 
@CatPlusPlus No license atm.
 
Well, invent one!
 
3:22 PM
lol
 
Oh my. That guy [from earlier]() really believes in crufty code premature optimization:
My point is, there is no realistic improvement even in the best case: the list won't be large enough to make that difference: Not large, typically less than 10sehe 1 min ago
 
Hey guys, I have just one quick question - STL deque, pop_back() function. How can I pop element wihout calling it destructor?
 
You can't, a container owns its elements.
 
maybe move it out?
 
You can switch the element type to a (likely smart) pointer, but I recommend sticking to value semantics.
 
3:33 PM
> c++ 31.189.391 (16817 answerers)
@LucDanton +1
 
Correct me if I'm wrong:
I have deque<Element*>, I've already added a few elements and now I'd like to pop last element. Will it call a destructor for Element?
 
No.
 
Wow, the view count on my question really exploded
~1500 views in about 15 minutes, after only 300 during the whole day
 
@KonradRudolph Did someone link it? I don't see it in any of the publicity badge listings.
 
@LucDanton
Element* RetVal = deque.back();
deque.pop_back();
Is correct?
 
3:37 PM
Sure.
 
Ok, thanks a lot :)
 
@Mysticial Well of course. ;) I tweeted it and got retweeted by several people, and John Carmack also tweeted it, albeit in a message to Xeo so this won’t be displayed in most peoples’ feeds.
 
ah. wow, 2k views already.
 
I was also thinking of putting it on reddit since it seems interesting but I don’t know (and don’t want to invest time to find out) which subreddit would be appropriate
ah, no
it’s #1 on hacker news
damn, was about to put it there myself
 
Interestingly, the highest average age is found in tags like , , , , and .... (is the top ranked by avg. age of answerer)?!
 
3:39 PM
to lose my HN virginity ;)
 
I _think_ the guy may have repcapped :)
 
WOW 35 is young
why does c++ range on such a young level
 
@JohannesSchaublitb Older people don't bother. Remind me to put my birthday down. I'll be saying farewell to you guys around november - I'll be turning 36...
 
Cuz *le kids heard games are made in c++.
 
@ScarletAmaranth ?!
 
3:42 PM
@sehe Yeah, I'll call you an elder.
 
1
A: rebuild the signature of a function knowing only its name and argument list

Johannes Schaub - litbWhat about template<typename T> struct identity { typedef T type; }; template<typename T> using NoDeduce = typename identity<T>::type; template<typename T> using Identity = T; template<typename ...P, typename R> Identity<R(P...)> *get_f(R f(NoDeduce<P>...

 
Well, Johannes asked why the age is on such young level in "c++". :)
name and argument list is nice but don't you need the return value as well ?
 
what is the best translation of "offended" to german?
 
angegriffen fühlen
 
3:46 PM
Schlag mich doch ...
angegriffen fuehlen is not really offended is it ?
Well, i guess i can't argue about this tho, neither of those is my native language :)
 
i thought about "verletzt" or "beleidigt"
but that does not really catch it
 
70 upvotes in 1 hour... is that a new record?
 
the first sounds good but it is ambiguous :)
 
verletzt is .. like, physically injured only, isn't it ?
 
3:48 PM
Lange Zeit habe ich nicht Deutsch gesprochen :(
 
Clearly, on the 'young' side it is all [tag:android-*], , , , . You can see the change happening with , , , , - where stuff gets more serious
 
i guess
"hurt" is better translated to "verletzt".
but not offended
 
What does google translate say :) ?
 
@JohannesSchaublitb I'd say 'beleidigt'
@ScarletAmaranth You're asking in the wrong place
 
@sehe It's too hot outside for me to use google translate! :)
@JohannesSchaublitb And beleidigt sieht ziemlich gut aus ...
"and", facepalm
 
3:50 PM
ohh
 
I think it is really context dependent, I can't decide if I like beleidigt or angegriffen fühlen better
 
hmm?
 
> auto window_factory = glskel::make_window_factory();
> auto window = window_factory->make_window(window_template);
vs
> core::display display;
> core::window window(display, window_template);
I think the new one is better.
 
Fewer Factories: always better
 
3:51 PM
To what extent is it possible to forget a language when very rarely used or exposed to ?
 
display is still kinda-factory, but more hidden. :P
 
@ScarletAmaranth Try it. I'd say very possible. Blunt object trauma to the head might help
 
Or less obvious.
 
@sehe Yeah I've just realized I haven't used German for ... 2 years
 
I keep forgetting about the languages I'm constantly exposed to
 
3:53 PM
Though I'll probably hide core::window and do named-arg-enable make_window.
 
i'm constantly exposed to 8 languages
english, german, bash, c++03, c++98, c++11, c89, c99
oh my god!
 
I can get back to formal languages pretty easily, even after years, but I don't remember a thing from German (last used 3 years ago, I think).
 
Im usually exposted to : Slovak (unfortunatily!), Czech, English, c++03 and c++11 ... And the sodding c99 in my "legendary" school :( Which means both my German and Python skills are suffering :(
 
why is it unfortunate you are exposed to slovak
 
Because my own native language sounds like trash to me :(
So does Czech really, they are extremely similar.
 
3:56 PM
I don't enumerate programming languages anymore, because I always forget to include something (and then look at it and go "oh yeah, I can write in that too").
 
@CatPlusPlus Agreed. Especially since there's no correlation at all between the ones you know well, and the ones you don't
 
I know many but not to an extent where i could say that I'd be able to write decent code in them.
 
like I could list Haskell, but I can hardly append to a list in it :P
 
I hate haskHell ...
 
Picking up new languages in most cases is rather easy, if you already know several.
 
3:59 PM
People hate what they don't understand :)
 
Getting to "I can write idiomatic code" takes bit longer, but it's not that hard either.
 
@StackedCrooked Well, i understand the paradigm, i like scheme ...
 
Paradigm shifts are the hardest part.
 
But some claim scheme is not really a fully "functional" language.
 
Scheme is not pure.
It's mixed functional/imperative.
 
4:00 PM
Well, it's not, but as far as I'm concerned, you can write pure functional in it.
Well, almost pure :P
Ok you win ... :)
 
Well, you can write imperative code in Haskell.
Besides, Scheme is LISP and LISP is ugleh.
 
Let's all write code in Cool.
 
hehe, I think that’s also the first time I had the “hottest question” on Stack Exchange
 
You can choose one of the trillion compilers.
 
@KonradRudolph Didn't you say the question was initially deleted?
 
4:10 PM
@KonradRudolph Hottest by a long-shot. I've never seem something go 300+ in "hotness".
 
gah! This answer is driving me crazy It has 52 upvotes, and almost everything it says is wrong, like: "there are no "real" arrays in C or in C++." The whole answer is about how it's theoretically impossible for a C++ implementation to know the size of dynamic objects.
2
 
@StackedCrooked No – only almost closed (4 close votes)
 
I see. Narrow-mindedness, nevertheless.
 
@Mysticial Does this mean anything though? I always treated these numbers as an inside joke …
 
@KonradRudolph No it doesn't really. It's just a formula. But it's the first time I've seen something go 300+.
 
4:12 PM
cool
:)
 
@MooingDuck we can and may edit it, right?
 
@Abyx I don't think rewriting his entire answer to be completely different is a valid "edit"
 
but I don't feel that it's a good idea to leave it as is
 
Lol, someone answered a two-year old question of mine on Superuser. And the question already had an accepted answer :D
 
Isn't runtime sizeof only in C99/C11 (applied to VLAs)?
 
4:16 PM
imagine that someone will use link to that answer as a proof that "there is no arrays in C++"
 
Runtime sizeof? Where is the world going to..
 
@StackedCrooked sometime answers can be improved.... try not to make fun of people that are trying to help
 
@StackedCrooked For VLAs in C99 yes.
 
@Scottymac I'm not making fun of him. LOL
 
there is no fun, really =(
53 people think that it's good answer
 
4:18 PM
@Mysticial VLA seems wrong to me. Despite convenience.
 
@CatPlusPlus I knew it was possible, forgot when exactly. I just realized that yes, it's only C :(
@StackedCrooked I wish C++ officially had VLAs
 
What for?
 
@CatPlusPlus fast vectors
 
VLAs would be superfluous when you have std::vector.
 
@CatPlusPlus faster
 
4:20 PM
Faster in what way?
 
not necessarily at all
 
@MooingDuck I don't. There will be a lot of questions like "why my program got stack overflow"
 
Waits for Cat to give a lecture on premature optimization.
 
I actually tried using a VLA (using _alloca) over std::vector once to speed up my program
 
@Abyx we already have that
 
4:21 PM
The only way it could be somewhat faster, is stack allocator vs default heap allocator.
 
it only made things wors
 
@CatPlusPlus obviously
 
Everything else is exactly the same.
 
@DeadMG really? I'll have to test it then
 
And heap doesn't mean "slower", either.
 
4:22 PM
AFAIK Heap allocation requires a system call. Stack allocation is simply incrementing the stack pointer.
 
@StackedCrooked it rarely requires a system call
 
Memory allocation for a heap requires a system call.
 
@StackedCrooked Only if the memory is not in an allocator cache, which is not terrifically likely to occur.
 
@StackedCrooked stack growing requires executing kernel code as well
 
yes
Windows uses guard pages to grow the stack
that involves throwing an SEH exception and catching it again in the kernel
then allocating that page, and then resuming as normal in the user mode
 
4:25 PM
@Mysticial I'm just saying performance is not simple. :(
 
not to mention that you can run into other memory locality fun
 
@CatPlusPlus he wasn't disagreeing with you
 
I bet I can fairly easily construct an example where a VLA is faster. But I've never actually had a need to use them myself.
@MooingDuck Correct, I'm not disagreeing with Cat. I don't use VLAs. :P
 
@Mysticial I can construct an example where UB is fine, but that doesn't make doing it a smart idea.
 
That's not really a good argumentation.
UB is never fine. While faster is sometimes desired.
 
4:29 PM
sure it is
no, that's not the point
the point is that just because a trivial example exhibits a property on your compiler on your operating system today does not mean that it's reliable in any way at all
 
@DeadMG I usually just use a constant maximum size. If the size is unbounded, you shouldn't use VLAs anyway. If it's provably bounded and small, then you can just use a constant maximum size.
That's why I don't use VLAs.
and also that it breaks C++ compatibility. That's a definite no-go.
 
I don't use them because I don't usually have a need
 
@DeadMG and 99.99% of the time I'd agree. But I don't like not having that option available
 
@MooingDuck I'd be more convinced if heap allocation was really that slow. But it just isn't.
especially if you use an appropriate custom allocator- like a memory arena, let's say
 
@Mysticial That's a good point. If you don't know the size at compile time then you are risking stack overflow when using VLA.
 
4:35 PM
@DeadMG I find heap allocation to be unacceptably slow for very large allocations. The OS is required to zero the memory. But that size is already well beyond the limit of stack allocation.
 
@Mysticial Why is the OS required to zero the memory?
 
63
A: Why does malloc initialize the values to 0 in gcc?

MysticialIt doesn't, it just happens to be zero in your case. Also your test case doesn't show that the data is zero. It only shows if the first element is zero. Generally speaking, malloc() will reuse memory from previous allocations. So in that case, it won't be zero. However, when the allocation requ...

It's subtle. When the OS gives you memory, it could have been freed from a different process. So that memory could contain sensitive information such as a password. So to prevent you reading such data, the OS will zero it before it gives it to you. But it's an implementation detail and may be different such as in some embedded systems. — Mysticial Nov 6 '11 at 19:34
 
HEAP_ZERO_MEMORY
0x00000008
The allocated memory will be initialized to zero. Otherwise, the memory is not initialized to zero.
 
That's the same as malloc() vs. calloc(). If it's small, it may not be zeroed - especially if it's recycled memory.
 
steal ALL the memory
 
4:39 PM
But if it's large and the OS must give new pages to the process, then it will be zeroed - regardless.
 
418 now on hot question list
 
@bamboon holy shit...
 
@Mysticial Did you actually test that?
cause all I'm saying is that the documentation clearly states that it will not be initialized to zero
 
@DeadMG I tested it with malloc() and VirtualAlloc(). They all zero if the allocation is huge (tens of MB or so).
 
except neither of those contain the flag I quoted
 
4:43 PM
You can try it yourself with HeapAlloc(). Try it with 1 GB blocks of memory. That should be large enough to prevent the allocator from caching it.
 
If I'm writing a generic list in C, how should I specify the deallocation function? When I create the list, list = List_Allocate(Foo_Deallocate), or when I destroy it List_Deallocate(list, Foo_Deallocate)?
 
Hello
 
@PaulManta Write it in C++ instead
 
@PaulManta what is "Foo_Deallocate"? Why do you pass it to the allocation function?
@PaulManta I don't understand your question at all
 
@PaulManta During the construction.
 
4:47 PM
@Mysticial You seem to be correct. I allocated 20MB and it all came back as 0.
 
@MooingDuck The custom deallocation function of struct Foo.
 
@PaulManta why does the constructor need that?
 
@CatPlusPlus Why do you think it's better?
 
@DeadMG :)
 
@Mysticial How curious. If I was designing the OS, I would say that if you have sensitive information, zero it yourself before returning the page.
 
4:48 PM
Because it makes no sense to be able to deallocate one list with two different deallocators.
 
@MooingDuck It doesn't need it, but I'm wondering if it's better to specify it during construction.
 
@PaulManta oh, I get it. You cache it in the constructor to prevent errors, and for any future functionality that may require it (resizing) or whatever
 
If it was allocated with allocator A1, it has to be deallocated with A1.
 
@DeadMG That's a good point. Though I'd assume that an extra layer of safety is more important than a bit of performance gain. (to the designers)
 
C++ containers take allocators in constructors.
 
4:49 PM
so what's the practical difference between passing lambdas as arguments, and passing function pointers?
 
The same as between passing elephants and oranges.
 
@PaulManta plus if you have a list of Derived, and treat it as a list of Base, you need to know the destructor ahead of time, because the destructor might not know?
 
@Mysticial Eh, I'd say that a performance gain on every single page allocated by every single process is more important than a tiny safety issue for a few applications that might have sensitive data.
 
@MooingDuck Not really a problem in C.
 
@stdOrgnlDave I guess the purpose of a lambda is clearer since the first time you see it is within the context that is is being used.
 
4:50 PM
@CatPlusPlus everything is a problem in C.
2
 
@stdOrgnlDave Stateful lambdas cannot decay to function pointers.
well, if you code in C, you get what you ask for, and I have little sympathy, unless some idiot professor/whatever makes you do it, in which case, I do have sympathy
 
I'm just looking to eke out more performance from software blitters that take different modes, and I mean a ton of modes. I'd like something cleaner than switch statements but there are so many ways to go right now. wish I could just use a little bit of self-modifying code...
 
@stdOrgnlDave 1. Download LLVM. 2. ??? 3. Profit.
 
@MooingDuck that's possibly because the stack is basically guarenteed to be in L1 cache, but wherever you're new/deleting isn't
@DeadMG clang has C++ support for self-modifying code?
 
@stdOrgnlDave clang != LLVM
 
4:54 PM
For small allocations, the overhead of heap allocation is the bookkeeping inside the allocator.
For large allocations, it's the OS zeroing.
 
user784668
@DeadMG The cost of a single fixed-length memset is not really significant when compared to all the job the kernel has to do in order to allocate a page for ya.
 
@Fanael It is when you consider that the memory block doesn't fit into the CPU cache.
 
@Fanael I don't think so. The page has to be brought all the way into cache and zeroed. When you're talking about MBs of memory, that's non-trivial.
 
user784668
Non-temporal writes.
 
in any case, the effects of that can be managed by re-using and pre-allocating on another thread, perhaps
 
user784668
4:56 PM
Also, if you're allocating it, you're going to use it right now, right?
 
@Fanael Doesn't matter, temporal or not, N bytes of memory still has to go into the processor and back.
 
@Fanael Uh, no.
there's a difference between "I'mma use all this stuff right now" and "I need it in cache right this instant"
 
@DeadMG indeed it isn't. but it is included as the C++ front-end. does it have some facilities for self-modifying code, yes or no?
 
@stdOrgnlDave How the hell should I know?
 
@DeadMG because you answered my question that way...whatever.
 
4:58 PM
and is it even relevant? LLVM will build and execute on, as far as I'm aware, all the major C++ compilers
even Visual Studio on Windows
Clang is irrelevant
you don't have to be using Clang to use LLVM
 
user784668
Anyway, if you think it is significant, then prove it. It's not a performance problem unless the profiler says you it is.
 
Anyway, is there any way to guarantee a DMA copy? would memcpy() be a good way to go or is there an OS-dependent solution?
 
@Fanael I don't think the user-mode profiler can profile the kernel-mode costs.
 
user784668
@DeadMG Kernel-mode one can, I think.
 

« first day (563 days earlier)      last day (4389 days later) »