« first day (608 days earlier)      last day (4566 days later) » 

06:33
1
Q: Simple program with 2 functions doesn`t work

Jason PaddleI'm newbie in C++ and trying to make 2 simple function but something goes wrong. So i need to do: 1.Function for input some data. 2.Function to show what data is input. I just want to make it simple. So the code that i write: #include <iostream> void masiv() { int x[10]; int n,...

Seriously, there's 3 answers saying to use global variables, which is obviously not the best solution there >.>
there's also an answer to use int instead of size_t
not as bad as globals, but still something worthy of a red underline when hand-analyzing the code
Is the answer not to use Perl?
@ScottW -3 now
The thing is, if that function was split into smaller functions, global variables wouldn't even seem like a good solution.
a common problem is STUFF ALL THE CODE IN main()
06:40
std::list<int> getInput();
ALL YOUR CODE ARE BELONG TO MAIN
the *only* thing i do in main is convert argc/argv to std::vector<string> and then parse the arg array as needed
or just use getopt
Passing variables is really easy when each function is cut down though
^ this
06:42
^ +1
boost is a hell of a library
True dat.
though xpressive tends to produce gigantic symbolic debugging tables
Also has handy stuff like the 'minmax' algorithm that returns a std::pair<T> after iterating over a collection.
stripping debug symbols converted a regex parser from a 10 MB .so to a 1 MB one
06:45
boost ftw.
which is why the stablest and most used parts of boost became the c++11 standard library extensions :p
Haven't found a need for xpressive yet, myself; although I suspect Spirit::Qi has a similar effect, I use external debug symbols so I'm not really bothered.
I've got a couple of libraries I'd love to tidy up for submission to Boost, but who has the time?
oh man, feeling fragile this morning
0
Q: Open MP -> not able to get a faster code tha nthe sequential one

Aakash AnujI am using open MP to speed up the flux calculation in my program. I basically want open Mp to carry out both of these left and right flux calculations in parallel. But on the contrary, the following code takes even more time with the #pragma directives. What do i modify to get it right? #pragma...

sigh...
xpressive so that i have compile-once regexes
06:49
4:48 PM here, and the Sun is down already.
plus, i like expression-template based grammars
@rvalue southern hemisphere?
Yeah, about 42°
seems like i'm suffering from amnesia.. i forgot what is the coined word for finding out what makes a program fail, memory leak in order to use that info to exploit a vulnerabilty.. is it "flash"?
buffer overrun?
Or are you looking for a verb for the attack?
06:52
@FrankComputer didn't know there was a word for that. 'flash' doesn't sound right to me though
I probably know this one, but it's 3:00 am
@rvalue s/overrun/overflow/
@chris False :P
similar, its a coined word anything that will cause an app to break.. "flash" is wrong, thats used for modifyung a BIOS
Meh, Wikipedia has both terms en.wikipedia.org/wiki/Buffer_overflow
@FrankComputer Or losing data 1MB at a time.
06:54
ita particular word i heard before.. its defined as tinkering with software to see what makes it break
not crash, bug.. but another similar style word
Like exactly what we did with the software our school uses to monitor/control our computers :p
@FrankComputer stress testing?
where you take a program to it's very limits to see just what it can handle
like example: SQL injection to discover a way of exploiting software... no, its not "exploit" either
'probing' maybe?
no
similar to "flash"
06:56
clash
its hacker jargon terminology
slash
trash
nope, not a soundex to flash
guess i should look in a hacker glossary?
@FrankComputer what is 'soundex'
soundex= sounds like .. its an oracle function
06:58
any ways, of to work :(
hmm, ever notice how this is valid: int main{ [](){}(); }. What do normal people think of C++ when they see that?
soundex's been around for over 4 decades.. when you tinker with a program to see what makes it break = {the hacker jargon word}
@chris Doesn't seem valid to me. :) Function parameter list.
@GManNickG, it's just calling a lambda
@chris For main. You're missing the function parameter list.
int main -> int main()
07:02
oh, duh
auto main() -> int { []{[]{[]{[]{}();}();}();}(); /* nop */ }
Yeah, that wasn't my obfuscated version
Try replacing half of those with digraphs
And if you're looking around for the 12 days of christmas thing right now, i'll kill you.
Nope.
Hah. TIL: cu.nniling.us is safe-for-work
I wish Boost had more stringent requirements for warnings.
07:08
yeah the first time i included a boost library i got hung on -Werror
phreaking=causing a program to abend?
posted on June 15, 2012 by Anders Schau Knatten

In which I show how to use static thread locals to reuse function locals between invocations, and why this can be especially important when allocating on the heap. Let’s say you are writing parallel software to process something. It has a single Processor object, with a member function process(). This function gets called from several [...]

Wow.
Maybe I'm behind in the times, but a very clever phish-bot on Steam exists, it takes a friend and copies their profile and avatar so you don't know the difference at a glance.
@Feeds uhm... but there is new and no delete
> GCC doesn’t support non trivial thread local objects yet
very sigh. I don't think we can actually start explaining that parallelization works best on a coarser level... Too bad no gets the energy together to actually tell him.
Ah well
07:18
I happened to look today of all days and found GCC 4.7.1 was done
VC++ could support non-pod thread-local objects, but it doesn't =\
@sehe Which is another reason why I'm writing a multithreading performance FAQ.
@Mysticial Where?
@sehe On notepad right now. :)
Just started?
07:26
@sehe Not really. I've been working on it on and off while I was on vacation last month.
As a sidenote, I think OpenMP is actually quite good, the way in which it specifies thread teams to be used. That is already a lot less braindead than the usual 'create thread when required' approach found in most roll-your-own threading solutions
@Mysticial Were are you intending to plublish it? SO? Do you have a blarg?
It'd say it's actually pretty much close to done. I might need some better examples though. But it's hard to find anything realistic that isn't too long.
@sehe SO
Ok, I'm interested. It could be a CW - or a tag wiki? I can see you'd like to get some rep of it (I assume it will be deserved too) but crowd clique-sourcing it may have it's benefits too
It'll be my first ask + self-answer. But of course I'll let other people answer with more examples.
Though it'll (the question) will probably be forced into wiki if it's too broad.
Sounds great.
Hehe. I think I only have ask+self answer. SO search usually sorts my troubles out
Which must mean my problems are always simple :)
07:31
To keep this one from being a "list-type" question and either closed or forced wiki, I'm putting specific examples into the question. Each of those will cover a different area.
@sehe I'll ping you when I'm getting close to posting the FAQ. If you can think of other good examples, I can leave them out of my answer so you can post your own.
@ScottW GoodForYou(TM)
@sehe Currently I have 5 examples that cover:
- Overhead
- Memory Bandwidth
- Shared resources/critical sections
- False Sharing
- Load imbalance
If there's anything else you'd like to add, feel free to "reserve" it.
I'm thinking about adding a NUMA example. But I doubt it'll be worthwhile since NUMA isn't common place (yet).
07:50
NUMA please!
great... now the problem is being able to construct a semi-realistic (and small) example that suffers significantly from NUMA...
lol
@Mysticial You can try asking it as an SO question :)
7
Q: Measuring NUMA (Non-Uniform Memory Access). No observable asymmetry. Why?

James BrockI've tried to measure the asymmetric memory access effects of NUMA, and failed. The Experiment Performed on an Intel Xeon X5570 @ 2.93GHz, 2 CPUs, 8 cores. On a thread pinned to core 0, I allocate an array x of size 10,000,000 bytes on core 0's NUMA node with numa_alloc_local. Then I iterate ...

That's actually what brought me to SO.
@ScottW I SCREAM!
Got that from Hyouka.
07:53
@StackedCrooked God, I'm so behind on that show...
@Mysticial I recently started watching it and it's awesome!
So far, it's only good for the graphics. lol
It doesn't get really good ratings so maybe it's just me that likes it.
@Mysticial The first scene where he meets that girl in the club room was kind of a strange mixture of 2d and 3d.
08:06
@StackedCrooked Asking how to "construct" an example would probably get closed as "not constructive".
@jalf Virtual Box man
@thecoshman Is that the title of a game?
@StackedCrooked jalf is bitching about VMware on twiter
08:30
mawning (again)
mawning
@ScottW I have a Nokia Lumia 800
@Mysticial Those are just the advanced topics... I think the SO audience really needs the bleeding basics laid out. Just simple stuff why doesn't it work to execute int f() { int 42; } in parallel. Why doesn't it work to schedule a 100-iter loop across a theadpool. (Depending of course on the loop body)
@sehe Well, here's the first example. I wouldn't consider it advanced.
**Example 1: ** Vector Addition (small)

double *A = ... ;
double *B = ... ;

#pragma omp parallel for
for (int c = 0; c < 1000; c++){
A[c] += B[c];
}

- 1 thread : **7.9996e-006** seconds
- 2 threads: **0.00020671** seconds **(26x slowdown)**
- 4 threads: **0.00039998** seconds **(50x slowdown)**
- 8 threads: **0.000655647** seconds **(82x slowdown)**
08:35
@ScottW I don't know if I have the time. I'm working a lot in the weeks, but I could always try it out sometime
What kind of game is it ? =)
Sadly, today, instead of Lame Puns, I only have tame runs of the same fun, which I, for shame, shun.
@sbi The problem is the language. If you speak Italian, it's actually quite clear.
sbi
sbi
@sehe Um. Are you sure you're replying to the message you wanted to?
@ScottW Cool =) Sounds ambitious!
@Mysticial I'm not saying they're 'too hard' or something. I'm really saying, they're irrelevant if you look at the basic issues most OpenMP questions are on about, IMO. It's a bit like micro vs. macro. I say, get the macro parallelization right, then do the optimization stuff^.
Unfortunately, I don't have a Windows computer, and I guess I need some kind of developer account / Microsoft thing
08:39
@Mysticial another way of putting it, your list could be described as micro-optimization issues ('mechanical sympathy') to keep in mind in the context of threading. I was more thinking about a FAQ on the high-level considerations when starting (to design for) parallelization
@sbi Of course
sbi
sbi
@sehe The few fragments of plain text on that blackboard are in English.
@sbi Vettor?
sbi
sbi
> Why do all new languages have to come with a wiki? What's wrong with a man page? Or a punched card deck? — Charles Stross
@sbi Because people are lazy. A wiki is often simpler to coordinate then anything else. See Room Kyrostat.
sbi
sbi
@sehe Oh, I missed that. Funny, the use of such a variable name, but the plain text in English.
08:42
@sehe I know what you mean. What I'm "trying" to do is to address all the people who try to parallelize (wrongly) a certain way. Then explain why it doesn't work and suggest ways to fix it (possibly at a higher level). But yeah, it's still a WIP. I haven't started running it by other readers yet.
@Mysticial A good example would be, the compiler guy that wrecks build times by parallelizing the compiler backend. However, a build system that builds various modules in parallel will usually benefit more if each module is built in single-threaded fashion.
@sehe If it's that high level, then it would probably be better on programmers.SE?
@Mysticial Mmm. I don't know. I don't frequent P.SE
Anyways, almost 4am here. Need to sleep, or I'll be back on Europe time.
Ok, sleep well
08:48
18 hours ago, by Cat Plus Plus

 Kyrostat

About to align DeadMG on a 16 smack boundary. Also, bacon.
What is this?
@thecoshman Not really an option when I need to be able to open existing vmware images
@jalf yeah, they've got you buy the balls :P
@FredOverflow Space game wrapped in bacon
Lounge<C++> decided to build a game
@Neil, please discuss the specific trials and tribulations in the Kyrostat Room. (Especially the money aspect of things... if at all relevant)
09:00
It's just so lonely in the Kyrostat room. :(
@StackedCrooked Interesting edge case, but yeah I think it's normal. Think:
struct X { friend struct Y; } // obviously, Y is not assumed a nested type
Oh! It's lame pun day!
@Neil Really? Oh. well. Everyone is at work, I guess
@sehe So am I, and so what?
> I tutored college students who were taking a computer programming course. A few of them didn't understand that computers are not sentient. More than one person used comments in their Pascal programs to put detailed explanations such as, "Now I need you to put these letters on the screen." I asked one of them what the deal was with those comments. The reply: "How else is the computer going to understand what I want it to do?"
> Apparently they would assume that since they couldn't make sense of Pascal, neither could the computer.
09:01
I'm totally working!
lol nice
@FredOverflow Makes sense. Like if you stick your head in the sand, people can't see you.
room topic changed to Lounge<C++>: Welcome to "Lame Pun Friday" [c++] [c++11] [c++-faq] [c++-fuq]
@Neil Just saying
Did you hear about the guy whose whole left side was cut off? He's all right now.
I used to have a fear of hurdles, but I got over it.
I was going to look for my missing watch, but I could never find the time.
Show me a piano falling down a mineshaft and I'll show you A-flat minor.
> Hey! I hate these Microsoft guys! What a rotten compiler! It only accepts 16,384 local variables in a function!
2
09:06
lol
A bicycle can't stand on its own because it is two-tired.
There was once a cross-eyed teacher who couldn't control his pupils.
I did a theatrical performance about puns. Really it was just a play on words.
The soldier who was exposed to mustard gas and pepper spray was a seasoned veteran.
@thecoshman also, as painful as vmware is, virtualbox isn't exactly stellar either. It's unstable, ugly and slow.
@jalf I find VBox to be quite usable.
But I don't use it heavily.
@StackedCrooked sure, usable, but not good
@ScottW Sure, I'll contact you later when I get home from work =)
09:28
@jalf I've found it to be rather good actually. Admittedly, I don't use it a huge amount
@FredOverflow ROFL
@jalf I find it to be okay in all departments. I'd like for the GUI to support raw disks, though
It feels like a Java application
room topic changed to Lounge<C++>: Welcome to Lame Pun Friday [c++] [c++11] [c++-faq] [c++-fuq]
Apparently, [links](http://....) don't work well in room topics
09:50
Gecko!
(echo)
Lots of testosteron in the bestest room
i_score_underwear
6 hours ago, by Pubby
int is not webscale
a hint is tell-tale
The room empty as-of now,
Punning my lonely ass off, wow.
I'm watching you
silly bear
10:16
Bear with me while I punt
At every word
Twisting it both punned, unpunned.
I hope I may, given leeway,
Avoid words runt and blunt, like _unt
> I know you're in there, variable; come out with your hands up. If it wasn't for this pesky object-orientation that's been foisted upon us and that I don't have the time or inclination to get to understand, I'd be able to read and write your variables.
Are you talking to an over-protective class, mate?
(<-- pun intended)
@ib. okay, I get the logic. I just think it is contrived :) My point was about readability. In that respect I think :help > :he > :h. Just a friendly note - I think you are awesome vim so, keep up the good work. — sehe 3 hours ago
While driving my daily commute, I found his edit/comment on the rote side
ohai
I'm reading this book about gravity, it's impossible to put down :P
May 22 at 12:45, by Neil
I'm reading a book about anti-gravity. It's impossible to put down.
oh for crap sake
someone stole my pun
that's not punny
10:27
but with crab _sake_, have a bowl of fun!
(sry, that's puny)
Surely you can't be making puns all day
it's Lame Pun day ALL day
I've only made two puns
@thecoshman pseudo make me a sandwich
Shirley can't be making buns all day
@TonyTheLion Just type them veeeeeeeeeeeeery sloooooooowly
@sehe nice tipping
10:35
Never invest in funerals, it's a dying industry.
Ah, I generally skip funerals
I'm not a mouring person
Anyway, hungry. Time for my mega-bites
afk
11:00
> I own a computer store. One day, two policemen came into the store and told that they owned a 486 and a 286. They asked if a 486 and a 286 could be assembled together into a 686. I replied to the dumb request by asking them if two 200 horsepower police cars can be used to make up a 400 horsepower Ferrari. The policemen didn't get it and replied angrily that altering car engines is strictly forbidden by law.
@ScarletAmaranth ohai
I'd love a game of billiards. But we have too few workers: they either fret pool, or they haven't the time for queue-ing
@DeadMG wrong room?
@sehe No, it's a reply to your pun, which means "It's so terrible, my eyes are bleeding".
11:06
Isn't this a terrible pun Friday ?
@DeadMG That's not what my pun means
@ScarletAmaranth The puppy acts unbearably dumb, I'll say
Let's talk about rights and lefts. You're right so I left.
Santa's helpers are subordinate clauses.
lulz
Oh gawd, I'm sad, with all my lame puns :P
lol, I'm already there
you're late
I don't do games. I just play onwards here
11:12
haha
did you just make that?
No, but I remember we did in 1984.
You know what, we all did last a summer
11:18
You do ?
lol
oh you want some puns, here you can find some punny threads :P
It's not lame link friday :)
Using cryptographic hashes is peanuts.
And I prefer them salted.
> What is the point of Olympic Archery?
really?
11:26
May 21 at 14:04, by std''OrgnlDave
by the way, in case you didn't catch my __ subtle hints __, I am an archer and archery is awesome
Yes Wheely
Mhm, damn, I want to pick up archery now!
@ScarletAmaranth Just follow the arrows. But watch your step, the arches get slippery
does sound like pun to do
Sehe is on fire :)
11:29
:P
@ScarletAmaranth Yeah. I guess we'll have to keep that chess game on the back burner.
Since you're taking up archery, let's leave picking up the gauntlet to chivalry, and avoid arch rivalry
@TonyTheLion What? I'm not invoking higher power. It's free of charge
Bear with me during lunch.
11:32
@sehe You will soon end up challenging me for a jousting duel xD
"That is not a constructor taking an rvalue, but a constructor taking an rvalue-reference." - I think that the statement the questioner made is way more precise than yours. A function does not "take an rvalue reference" or "take an lvalue reference". It "takes an rvalue" or "takes an lvalue". His constructor can in fact only take rvalues, so his statement was perfectly precise. (And yours wasn't. X && x = ...; foo(x) passes an rvalue reference, but foo won't take it, because it passes it as an lvalue instead of as an rvalue). — Johannes Schaub - litb 25 secs ago
folks
matey
Well, I think people also get confused with the fact that an rvalue can easily become an lvalue as soon as you pass it around, then everything breaks :)
g-values, gripping hand values
I think he confuses "takes X" and "has param type X"
11:38
need more of those
I think of them as gay lvalues.
The Gripping Hand is a 1993 novel by Larry Niven and Jerry Pournelle. It is a sequel to their multi-award-nominated 1974 work The Mote in God's Eye. The Gripping Hand is, chronologically, the last novel of the CoDominium universe it is set in (though in 2010, Pournelle's daughter released an authorized sequel). In the United Kingdom, it was released as The around Murcheson's Eye (sometimes misspelled "The around Murchison's Eye"). The Gripping Hand revolves primarily around two minor characters of the first book, Captain Sir Kevin Renner (ISN, Reserve) and His Excellency Horace Bury, ...
@JohannesSchaublitb Cheerful lvalues ;) ?
@ScarletAmaranth If I just pick the gauntlet up slow enough, I'll win hands down!
11:40
@sehe The gauntlet can't be picked up slowly, it's heavy.
@ScarletAmaranth I'll just cheat using a computer pro gram
@sehe Gimmeh some more unbearable puns ...
I give up, markdown is a disaster :(
fuck markdown
> Markdown is a lightweight markup language
hi guys
now what direction are we going here? up or down?
11:45
all are developer her ?
@ScarletAmaranth When we play a game of chess, you'll discover the meaning of Growl Play
@Krunal No we're waiting for 5 more
@Krunal no, we're just a bunch of lame punners
But C++ is great pun
11:48
C++ is not a pun, C++ is a joke, just like PHP
you all are from which country ?
oh no, PHP is beyond a joke
:D
@TonyTheLion Have you just compared c++ to php :D ?
@ScarletAmaranth I did, I committed an unforgivable sin :P
@TonyTheLion No need to muck farkdown, put up a scene or put Mark down. I know where that's heading.
@Krunal Yes. Witch country is sweeping the nation.
11:49
lulz
@TonyTheLion Do you want me to ... burst your buble ?!
you all are from which country ?
Different ones.
@ScarletAmaranth my bubble? I ain't got no bubble, I know PHP sucks and C++ sucks too
bubble bursted
But PHP sucks slightly more.
11:50
yea true
PHP sucks way more :)
php is one big security vulnerability
@chris value might have operator== overloaded for ints, so the behavior might be different from what you think.
I watched a video talking about exploiting PHP-nuke yesterday, woah, it's so fricking easy, it's rediculous
I mean who writes this shit?
I think it was like a single guy really bored
11:51
like 5 vulnerabilities in the same admin page of the same damn version
he called it personal homepage something or whatever
and three versions later, they still exist
I watched a video about JavaScript once, and the guys said: "as you all know, JavaScript is prototype-based."
and then he realized he's braindamaged but it was too late
lol
@RadekSlupik JavaScript is actually really bad too. I mean it can really be abused
11:52
JavaScript is at least better than PHP.
Everything is better than PHP, except for Java maybe.
@ScarletAmaranth PHP impairs, C++ impales. No match
javascript is a nice language
2
11:53
or rather, it contains a nice language
just like C++
it is a nice language
but it has some quirks
a lot of cruft, hiding some nice bits inside it
PHP++ will make it more difficult to shoot yourself in a leg ... oh who am I kidding.
PHP doesn't make you shoot yourself in the foot, but rather in the head.
@ScarletAmaranth Java > PHP
11:56
@ScarletAmaranth That's because it is broken. However you can wait for it to jam and backfire
FUCK CSS
PHP is a weapon of mass delusion.
The top margin is two pixels larger than the bottom one.
I hate layouts and CSS and browsers.
PHP > CSS

« first day (608 days earlier)      last day (4566 days later) »