« first day (403 days earlier)      last day (4558 days later) » 

6:00 PM
What are "globuls"?
 
However, advanced high-quality C++ may trigger a number of WTFs when reviewed by a lesser informed reviewer.
 
Quotes.
 
Globals.
 
Glowing bulls.
Abbreviated.
Fact is that English spelling seems to have no relation to its pronunciation at all.
2
 
6:02 PM
do you mean spelling?
 
@CatPlusPlus have you noticed the distinct lack of #includes in headers?
 
@StackedCrooked get hooked on phonics. It worked for me!
 
@keithlayne do you recommend me the age category of "8 and up"?
I don't have problems with English spelling. Typing is more often the issue in my case.
 
@StackedCrooked what? Are you 7?
 
6:06 PM
@keithlayne See the left-hand column in the page you linked.
 
@StackedCrooked They used to have commercials all the time on TV here. It was funny about 20 years ago.
 
sbi
@CatPlusPlus Shameless plug: I used this here.
 
2
A: Oneboxing for SO answers is broken

balphaI'm not convinced it's a good idea to have answer short URLs indistinguishable from the question ones, and we're considering changing that (of course, /q/{id} will continue to work either way, just as it did before; this is just about "what does the UI give you"). Anyhow, oneboxing answers with ...

It workses!
 
sbi
@RMartinhoFernandes Great!
 
Not very accurate.
 
this is lame
Apple, you suck
 
@sbi Thanks asking about the https links to xkcd
 
Why are you telling us where you're from?
 
hmm yeah, i didnt get it, thought it was a screenshot
but then again its not really accurate
 
6:36 PM
Yeah, I know. It reads "Lisbon" for me.
 
i actually think, one can do better
 
mygod google asks so harder questions in Interviews...how to prepare for it?
 
sbi
@RMartinhoFernandes How do you make google display this?
@MrAnubis If you feel like you need to prepare for an interview, you're probably not the right guy for the job.
 
@sbi When your browser requests that picture, the server generates it on the fly. (It's got nothing to do with Google btw)
The Google logo is just there for... I don't know why.
 
@sbi why so ? many does I think
 
6:42 PM
Hey help me overcome this confusion: I have a class with a vector as a private member. When I'm in the body of the constructor is it guaranteed that the vector is already constructed?
 
@Nils yes
 
sbi
@RMartinhoFernandes Ah, Ok, now I get it! I thought your point was that it says "Germany" for you.
 
ok
 
haha sbi got tricked like me^^
 
So if I want to call another constructor than the default one for vector I have to do it either in the initialization list or I have to reconstruct it?
 
sbi
6:44 PM
@MrAnubis That company makes their interviews hard to pass because they want to employ only the best. If you have a hard time getting through the interview, you might not to be up to what's coming at you should they hire you.
 
the initializer list is the place to initialize members
you cant do it anywhere else. Anything you do afterwards is assignment, not initialization
 
I guess I should use vector::assign then.
 
sbi
27
A: What is this weird colon-member syntax in the constructor?

James McNellisIt's an initialization list. You should find information about it in any good C++ book. You should, in most cases, initialize all member objects in the initialization list (however, do note the exceptions listed at the end of the FAQ entry). The takeaway point from the FAQ entry is that, ...

 
@Nils what are you trying to do?
 
I know about initialization list.
 
6:46 PM
Then use it!
 
Initializing a vector using the {1,23,4} syntax
 
It doesn't byte.
 
right now I do int tmp[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,-1};
numbers.assign(tmp, tmp + sizeof(tmp) / sizeof(int));
in the constructor
 
@sbi So true..nothing more to say now..
 
yeah, can't really solve that problem properly in C++03
C++11 allows you to do it
 
6:47 PM
there is no way to do this in the initialization list, because it requires a temporary array
 
some_class() : v{1,23,4} {} should work too.
 
ah
it was red in vs
 
@Nils No, it doesn't!
 
let me try
 
VS doesn't support it :)
 
6:47 PM
Oh, VS may not support that.
 
sbi
@Nils This answer doesn't only explain what it is, it also said you should prefer it over other ways to initialize variables.
 
It's a C++11 feature
 
ah
will have to get vs2012 then
 
I'm not sure that will support it.
 
that won't support it either
at least not at launch
 
6:48 PM
If you think VS11 means "more C++11" support, you're dead wrong :(
 
I've heard it'll be in VS3014.
That was a weird typo, brain.
 
uhh I thought 2012 would be pretty complete
 
It won't have much more than it already has.
 
it'll have scoped enums!
and, uh... some library stuff
 
6:51 PM
They might as well used this instead of changelog.
 
@CatPlusPlus lol
 
Yeah. And wait until Clang works properly.
 
No, we have to be impatient.
If you are patient, this is what you get.
 
@jalf According to your blog that means never, right?
 
6:54 PM
@keithlayne we'll see. They've hinted pretty strongly that they'll deliver variadic templates post-launch
but I'm not counting on anything more than that
 
@jalf Oh, that's cool.
 
@jalf that was a great pair of blog posts though
 
@keithlayne the ones about Connect?
 
roger that
 
well @RMartinhoFernandes probably the industry adoption of c++11 is slow, so vendors can afford slow adoption
 
6:56 PM
@Nils Doesn't that sound like a chicken-and-egg problem?
 
oh
I see I missed the sex talk
meh
 
@RMartinhoFernandes maybe
 
oh and it went quiet
 
@jalf 2014 will be post 2012 launch. xD
 
wow the lunch I made is gross...bummer. The kids won't touch it.
 
7:00 PM
struct command commands[] =
{
#include "commands.inc",
{NULL, NULL}
};
that looks mighty invalid
is it? (In C)
 
The comma is misplaced
 
where should it be?
 
not necessarily
 
Not on the same line as #include?
 
@keithlayne oh, what the heck did you do?
 
7:01 PM
oh
 
Either at the end of the included file, or on next line.
 
Also, that looks more disgusting than @keith's food.
 
X macros.
 
@TonyTheLion yeah well it almosts sounds awesome, a stir-fry with peppers, mushrooms, tomato, zucchini (thank you spell check), some unknown gourd, with vermicelli & spices etc tossed in. Just didn't work out. McDonalds it is then.
 
ah
I see
 
7:06 PM
I don't know what half of those things are.
 
prob why they can't be eaten :P
no one has any idea what he put in his food LOL
 
Tasty.
Oh, "vermicelli" is "little worms".
 
@RMartinhoFernandes this vermicelli is actually "bean strings" which are bean sprout stuff that looks just like the rice noodle equivalent. Not bad.
it was really just that fuckin green pumpkin looking thing that ruined it all.
 
7:30 PM
I can produce all primes from any 1M interval in about 5 seconds... but that's still too slow by a factor of 100. :-(
 
What do you need the primes for?
 
It's some coding challenge. The requirements are pretty tough!
 
Is the algorithm parallelizable? Then simply buy 100 computers.
 
Has to run on the host's machine
 
any 1M interval? Isn't the problem harder for bigger numbers?
 
7:31 PM
It's not about how much hardware I can muster, but about figuring out how this is possible
The prime density goes down, so it should get easier...
 
But you have to check more potential candidates.
 
Evening
 
I precompute a set of primes (there's a sweet spot for how many), and then I sieve the range
 
I see.
 
Hm, but many of the numbers that are composites are discovered quickly
 
7:32 PM
Do you precompute up until sqrt(n) or something? ;)
 
No, just up 32K. About 6000 primes
 
What data structure do you use for the sieve?
 
Actually, if I precompute more numbers, the time searching through the existing primes dominates and is much longer
An array uint32_t[32*1024]
accessed bitwise
 
What exactly do you mean by "precomputing"? When do you compute the array?
 
At the beginning. Only takes a fraction of a second
 
7:34 PM
Okay, so hard-coding them into the source wouldn't make much of a difference?
 
Like this: I precompute all primes in the range 0..32K.
Then I get an interval, say 1000000000...1001000000.
Then I make a sieve of 1M entries, for 1000000000 + i.
 
got it
 
then I spray the multiples of each composite over the sieve. E.g. the first number is a multiple of 2, so I mark every 2nd element from i = 0 onward
Then I only iterate over the unmarked is
 
I know the sieve algorithm :)
 
:-)
I can't think of any faster way
I mean, nothing that's faster by a factor 100
 
jli
7:37 PM
Sieve algorithms are the fastest way to compute primes iirc.
 
You're accessing quite a lot of memory. That might be the bottleneck.
 
most of the time is spend finding a factor of a candidate number
Just iterating over my initial prime collection is the by far dominant activity
 
You know, CPUs are orders of magnitude faster than memory nowadays.
 
Hmmm
My prime database is already a vector<unsigned int>, don't know how you'd improve on that
 
If you can find a way to access less memory, that should already give you quite a speed boost. The only question is how, of course :)
 
7:38 PM
I vary the type to short int and long int, no effect
Well, I can precompute fewer primes and brute-force more factors
 
Well, the first array probably fits into L2 cache, no matter if it's short, int or long.
 
32K is my experimental minimum. With 16K or 64K I get far longer times.
 
interesting, must be some cache effect
 
With 16K precompute, I spend lots of time on brute forcing; with 64K the search times become large.
I could cachegrind the thing
See if there are many misses
 
cachegrind = linux?
 
7:40 PM
It's a valgrind tool. Valgrind has many tools.
Heap debugger, heap profiler, cache profiler...
Hm, L2 miss rate is 0.13%
 
jli
@FredOverflow You can't really make that comparison, it depends on the application.
 
@KerrekSB Are you getting a lot of false sharing?
 
@jli What are you talking about? I was asking whether cachegrind was a linux only tool.
in Haskell, 12 mins ago, by FredOverflow
Yay, two recent videos by Simon Peyton Jones!
 
@FredOverflow Who's that? And what does he usually talk about?
 
@ManofOneWay If you don't know who Simon Peyton Jones is, you're probably not going to be interested in the videos ;-)
He's a Haskell Guru.
 
7:49 PM
@FredOverflow Who knows, there must be a first time for everything
 
@ManofOneWay What's that?
 
jli
@FredOverflow I was referring to when you said "You know, CPUs are orders of magnitude faster than memory nowadays." My chat just lagged a whole bunch.
 
Hm, maybe I deemphasize the lookup through precomputed primes and instead try to make bruteforcing faster by inserting a quick compositeness test.
Screw the sieve
 
@KerrekSB That's when you are sharing cache lines between threads but not the data on the cache line, then one thread A is changing some data in the cache line that thread B is not using, but that is still forcing thread B to reload the cache line
 
@jli Are you seriously questioning that statement? You know that 99% of the cost of a CPU is spent on caching circuitry and only 1% on the actual computation circuitry, right?
 
jli
7:52 PM
@FredOverflow yeah, but if your program is extremely computation heavy with less mem access, then it's going to perform differently than a memory heavy program.
 
@ManofOneWay Judging from the 0.13% L2 miss rate, I doubt there's false sharing going on.
 
@jli of course it will, that doesn't contradict my statement
 
jli
@FredOverflow unless you're comparing the clock speed of memory to the clock speed of a CPU, then it's completely relative.
 
@RMartinhoFernandes yeah I also doubt it. I just wondered if he had looked at it
@RMartinhoFernandes My question was badly phrased
 
7:53 PM
@jli What else did you think I was comparing?
 
jli
@FredOverflow the relative speed for the average of applications.
Or something.
 
well... nope :)
 
@FredOverflow Just out of curiosity, what are you developing in Haskell?
 
Slow memory is one of the reasons C++ is so popular in high performance applications. Less meta-data -> less memory access -> less waiting -> higher performance
@ManofOneWay Nothing, I just love the language.
 
@ManofOneWay I have only one thread, though
 
7:57 PM
The most complex program I have ever developed in Haskell was a "Connect Four" AI.
Oh and a brute-force boolean expression simplification program.
 
@FredOverflow What's so special about it?
 
The fact that it's awesome.
 
@ManofOneWay Haskell is extremely different from every other programming language I have encounter before and ever since. Everything is special about it.
 
I haven't used it so I'm not saying it's bad, I'm really just wondering
 
For example, it has no objects, and you can't mutate variables :)
 
7:58 PM
ST doesn't agree with you :)
 
It has first class functions, higher-order functions, implicit currying, type classes ("higher-kinded" types or something), type inference etc.
Basically, Haskell is one enormous type orgasm.
 
Overloadable arbitrary sequences of symbols (aka operators)!
 

« first day (403 days earlier)      last day (4558 days later) »