« first day (840 days earlier)      last day (4094 days later) » 

10:04 AM
yes the thread uses memory resources, primarily wasted stack memory - wasted if the thread sits and does nothing a lot
not that big of a deal if you don't have a large number of idle threads
 
how can this be reduce?
since it is very bad
i suppose
 
threadpool/asynchronous design
 
user142019
 
So, what's for lunch today?
 
@Zoidberg why bother with that regex lol
 
10:13 AM
asynchronous is just a mulitask
 
user142019
@wilx regex.
 
user142019
@RyanFung uh no not really.
 
or focusing on multiple process
 
@RyanFung you're not waiting, that's the key difference
 
user142019
You can have async I/O on one thread.
 
10:13 AM
Who cares about unused stacks? They get swapped out, like other memory stuff.
 
user142019
And it's done that way very often.
 
@MartinJames context switches
 
If the thread is not doing anything, then there are no context switches associated with it.
 
it's far more efficient to loop and run short threadpool work items than switch threads with a big fat syscall
 
@doug65536 Yes, it is.
 
10:15 AM
Right, because there are no context switches in threadpool
 
O YEA!
context switching
thanks for opening my midn
 
user142019
Threads suck and I/O sucks.
 
user142019
Don't use either of them.
 
lol
 
Heh!
 
user142019
10:17 AM
Even better, don't use a computer.
 
user142019
All problems solved.
 
@CatPlusPlus it reduces context switches because a lot less threads ever wait and have to wake up if you use threadpool properly
 
Yes, that's my plan for today, (for work stuff anyway).
 
user142019
@doug65536 Except that the entire progress will run longer because you have a lot of tasks waiting on the queue, and those need context switches too when they're running.
 
If your threads mostly wait then you should have less threads
 
user142019
10:18 AM
You have less threads, but those threads last much longer.
 
What Cat says
Mawning
 
But really threadpool is just a bunch of threads and nothing magical
 
user142019
@TonyTheLion Moaning.
 
You been up all night?
 
If the threads mostly wait, why bother reducing the number?
 
10:19 AM
So threads have more work and less wait
 
the magic of windows thread pool is all blocking calls notify the threadpool so it immediately knows that a core is unused, and it uses systemwide information to throttle thread creation
 
user142019
If you want a large amount threads and only few context switches use a language that offers green threads such as Erlang.
 
user142019
In fact, use another language anyway since C++ is terrible.
 
Grren threads are about as effective as windfarms.
 
c++ is terrible in threads??
@@
although i know C# handles better
 
user142019
10:21 AM
Yes, and terrible in general.
 
Green threads are wonderful
 
user142019
Green threads are great.
 
user142019
And I love Erlang.
 
user142019
And Haskell.
 
user142019
Because no global state + threads = WINRAR.
 
10:22 AM
Does this look like a Windows Phone Helpdesk Channel
 
somebody know means, please tell me.
 
I sense a 'gree threads' windup/troll attempt... :)
 
@GopinathPerumal lame <- the name of an mp3 encoder
 
user142019
inb4 Luc bin.
 
10:23 AM
1 message moved to bin
 
The only thing green threads are not really good for is heavy computational work
But that's really not that common
 
user142019
Use OS thread for that if it's a problem.
 
user142019
forkOS :3
 
@CatPlusPlus ..and I/O, and any other blocking calls, and just about everything.
 
No, they're better for I/O than OS threads
 
user142019
10:24 AM
@MartinJames watno.
 
user142019
Green threads are especially good at I/O.
 
@doug65536 lame is not working that's why I came for your help, I thought , I may get some help from stackoverflow. Sorry for the disturbance!
 
user142019
And if you want non-blocking I/O, use non-blocking I/O with epoll or kqueue or friends.
 
user142019
(Except for regular files, where it makes no sense.)
 
user142019
And oh God I/O is terrible. It always goes wrong and it's slow and it must be validated and buh.
 
user142019
10:26 AM
In the ideal world, humans would be perfect and I/O would never fail and input validation was never necessary since everything would be correct all the time.
 
You're just bad
 
user142019
No, I/O is bad.
 
I/O is rather vital though
so deal with it
0
Q: Is contexpr "[v[n]]sprintf" possible?

rubenvbMy intuitive answer is yes, and the implementation could also be used by a "printf". And it might be easy to overload for user-defined types. Has anyone ever attempted this before?

dafuq?
 
user142019
lol an I/O-less program.
 
1
Q: Tag dispatching on mixed runtime/compile time condition

rhalbersmaI have the following tag dispatching code (see LiveWorkSpace) #include <iostream> // traits types struct A {}; struct B {}; struct C {}; // helpers void fun_impl(bool, A) { std::cout << "A\n"; } void fun_impl(bool, B) { std::cout << "B\n"; } void fun_impl(bool b, C) { if(b) f...

hmmmm
not a stupid question
now, silly question, but isn't SFINAE and tag dispatching essentially the same thing?
 
user142019
10:40 AM
 
Hello, I am a C++ programmer with Windows experience and now I am learning the C++ programming on Linux (actually on Ubuntu). My little problem now is that #include <codecvt> does not compile with a "fatal error: codecvt: No such file or directory". I have libstdc++6-4.6-dev
GNU Standard C++ Library v3 (development files), does it carry codecvt?
 
look at the tags in the tag line
 
ah, ok, thank you
 
Compile with g++
 
10:55 AM
...
questions are fine.
having that tag there is dumb
@uvts_cvs What is codecvt?
oh, huh, it's standard
 
I didn't even know that o.O
 
codecvt is the thing that nobody knows about
Along with the rest of C++ locale machinery
 
10:56 AM
yeah
@uvts_cvs: What Cat said, then. Are you accidentally invoking gcc instead of g++?
(And thus have the wrong include paths in effect)
 
@LightnessRacesinOrbit thank you, I try g++
 
@uvts_cvs soo what were you using before?
 
@CatPlusPlus g++ -std=c++0x test.cpp gives me "fatal error: codecvt: No such file or directory"
@ligh
 
weird
your install is fucked.
 
@LightnessRacesinOrbit before of what? i'am just testing a snippet
 
10:59 AM
what about other standard headers?
 
@LightnessRacesinOrbit I am afraid, even if I compile #include <thread> gives me no error
 
@uvts_cvs before trying g++. nm.
@uvts_cvs weird
 
Include <locale>
 
std::codecvt appears to be declared in <locale>
yeaaaah it's a class template, not a header
there you go. well done Cat.
 
@CatPlusPlus locale is fine, no error, but I think codecvt is an header too, see the code snippet here: en.cppreference.com/w/cpp/locale/codecvt_utf8 it does not compile on my ubuntu
 
user142019
11:04 AM
Rainbow parentheses baby.
 
user142019
Awesome.
 
what?
 
Probably not implemented yet
 
user142019
My code is so colorful.
 
user1182183
soo much tags, btw, if I make a bool gRunning = true; then I do while(gRunning) in a thread and from another thread I do gRunning = false; , will that be bad or is this allowed?
 
11:05 AM
Oh wait, 4.6
 
@CatPlusPlus yes, maybe not implemented, ideone say the same thing ideone.com/Jpx2cl
 
Definitely not implemented in 4.6
Upgrade to 4.7
Well or 4.8
 
@CatPlusPlus how can I know what is implemented in, say, 4.6?
 
user142019
 
user142019
Especially useful in Lisps.
 
11:07 AM
@uvts_cvs Looks like a wiki typo
 
@CatPlusPlus yes, maybe, 4.8, ideone has gcc-4.7.2 and is failing
 
@BartekBanachewicz What for?
 
@Zoidberg oh back to zoidlang eh
 
user142019
Only wish it worked with C++ template hell.
 
@LightnessRacesinOrbit :-)
 
user142019
11:08 AM
But that would conflict with the < and > operators.
 
@uvts_cvs note that the link to that header is red because there is no article for it. pretty sure it's a wiki article bug.
 
user142019
rainbow_parentheses.vim would need a C++ parser. ;_;
 
well spotted and well done for using documentation
sorry to sound condescending but most people seem not to fucking bother nowadays
 
you have a point
 
user142019
Also useful in Erlang tuple hell.
 
user142019
11:11 AM
Skittlecode.
 
user142019
Krupuk are deep fried crackers made from starch and other ingredients that usually give the taste. It is a popular snack in parts of Southeast Asia and East, it is known as krupuk or kerupuk in Indonesia; keropok in Malaysia; kropek in the Philippines; bánh phồng tôm in Vietnam and xiapian (虾片 "prawn chips") in Chinese. It is also known as kroepoek in the Netherlands through its colonial link with Indonesia, and another of Nederlands' former colonies, Suriname. Prawn crackers or shrimp puffs are common snack food throughout South East Asia, but most closely associated with Indonesia and ...
 
user142019
I want.
 
...Doesn't get.
 
@LightnessRacesinOrbit I see the red link to the header in cppreference.com... but my draft n3290 of the standard says <codecvt> is an header "22.5
Standard code conversion facets
1 The header <codecvt> provides code conversion facets for various character encodings." I am confused
 
@uvts_cvs You're also right
 
11:21 AM
@LightnessRacesinOrbit is there any way to know what is implemented in a certain version of libstdc++ ?
 
OK, new answer. The wiki is incomplete, and your GCC doesn't support that yet.
@uvts_cvs: Yep
Did you google "GCC C++11" yet?
 
user784668
@uvts_cvs TIAS?
 
@Fanael He did. It didn't work. Now he needs to know whether upgrading will help.
 
user142019
Chromium why the fuck do you add a fucking XML comment when I save a .txt file.
 
I can't find the code conversion facets in GCC's lists :(
 
user142019
11:24 AM
Chromium, why the fuck do you save a .txt file as HTML. T_T
 
so GCC 4.7.2 has it at least
yet,
> yes, maybe, 4.8, ideone has gcc-4.7.2 and is failing
Oh, sorry I'm looking at tr1/codecvt.h
Wow, this is difficult
 
@LightnessRacesinOrbit I have naively ried to include <bits/codecvt.h> but it does not work
 
user784668
@LightnessRacesinOrbit Not in 4.8
 
user784668
>> /mingw/xcompiler/out-dir/bin/x86_64-w64-mingw32-g++ -std=c++11 abcd.cpp
abcd.cpp:4:19: fatal error: codecvt: No such file or directory
 #include <codecvt>
                   ^
compilation terminated.
 
I can't find any evidence that libstdc++ supports it even on trunk yet
 
user784668
11:27 AM
@LightnessRacesinOrbit Evidence to the contrary ^^
 
@Fanael where?
 
user784668
1 min ago, by Fanael
>> /mingw/xcompiler/out-dir/bin/x86_64-w64-mingw32-g++ -std=c++11 abcd.cpp
abcd.cpp:4:19: fatal error: codecvt: No such file or directory
 #include <codecvt>
                   ^
compilation terminated.
 
Er, that's evidence that it's not supported.
 
user784668
That's GCC 4.8 compiled twenty minutes ago.
 
Because it, like, didn't work.
Oh, I see what you meant
Yes, assuming GCC 4.8 uses libstdc++ trunk, that's further evidence that this search is fruitless
 
user784668
11:29 AM
@LightnessRacesinOrbit They're in the same repo. You svn update GCC, you svn update libstdc++ too.
 
okay
there you go then
it would be nice if GCC's compliance status were easier to parse/follow and more thourough
guess they don't have much in the way of time & resources
 
@Fanael externals more likely
At least AFAIR
 
user784668
@CatPlusPlus But they're not.
 
@Fanael srsly?
 
user784668
11:36 AM
@LightnessRacesinOrbit No.
 
@Fanael you're not serious?
 
user1182183
is T volatile VariableName C++ standard or Microsoft Standard?
 
user784668
@GamErix C++.
 
user1182183
ah okay thanks :x hurray for cross compatibility then xd
 
@GamErix yes and no. volatile doesn't do much nowadays.
 
11:39 AM
volatile prevents optimizing memory access away.
That's pretty much all it does.
 
user1182183
@LightnessRacesinOrbit ah well I just want a bool to be accessed by two threads, (bool volatile gRunning;)
 
Well, and optimizing other things, too.
 
user1182183
and I read somewhere I need to use volatile for that
 
user1182183
5
Q: Is it safe to use a boolean flag to stop a thread from running in C#

LirikMy main concern is with the boolean flag... is it safe to use it without any synchronization? I've read in several places that it's atomic (including the documentation). class MyTask { private ManualResetEvent startSignal; private CountDownLatch latch; private bool running; MyTa...

 
11:40 AM
15
A: Volatile in C++11

Nicol BolasWhether it is optimized out depends entirely on compilers and what they choose to optimize away. The C++98/03 memory model does not recognize the possibility that x could change between the setting of it and the retrieval of the value. The C++11 memory model does recognize that x could be change...

 
user1182183
i know it's C#..
 
@GamErix Adding volatile is not a magic bullet to make your variable thread-safe. It will not magically do that.
@GamErix It's a common misconception.
 
Yeah because C# has so much in common with C++
 
48
Q: Why is volatile not considered useful in multithreaded C or C++ programming?

Michael EkstrandAs demonstrated in this answer I recently posted, I seem to be confused about the utility (or lack thereof) of volatile in multi-threaded programming contexts. My understanding is this: any time a variable may be changed outside the flow of control of a piece of code accessing it, that variable ...

 
user1182183
even not one bit? -.-'
 
11:41 AM
Use atomic<bool>
 
user1182183
ah okay thanks
 
@LightnessRacesinOrbit "What volatile tells the compiler is that it can't optimize memory reads from that variable."
 
The "C" in name
 
That's exactly what I said.
I did not say anything about threading or so.
 
@Griwes Yes, I know what volatile does. Did you read the rest of the page?
@Griwes This dude asked about it.
> ah well I just want a bool to be accessed by two threads, (bool volatile gRunning;)
 
11:42 AM
@LightnessRacesinOrbit Then why did you direct that link at me? ;D
 
@GamErix But please read the page even though you have just been spoonfed half of the final answer
@Griwes Look again!
 
@LightnessRacesinOrbit Here we go.
 
Hello Homosapients
 
@LightnessRacesinOrbit Edits for the win.
 
11:44 AM
@Griwes Loser
 
user1182183
@LightnessRacesinOrbit yes i'm reading the "Why is volatile not ... "
 
lol
 
@SachinPrasad What is a "homosapient"?
 
But guys guys it totally works in C# so it'll work in C++ too
 
@GamErix gdgd
@CatPlusPlus C# is just C++ written shorter
 
user1182183
11:46 AM
they talk bout memory bariers but no demonstration or code, is std::atomic<bool> a kind of memory barier thing? ; o or just ensures atomic operations.
 
@LightnessRacesinOrbit Thats for you to find :)
 
@LightnessRacesinOrbit Thank you very much for your help!
@CatPlusPlus Thank you very much for your hepl!
@Fanael Thank you very much for ypur help!
 
wow
triple thanks twister
 
@uvts_cvs np ;p
 
user784668
11:56 AM
@rubenvb Remember when I told you I managed to break LTO on x86_64-w64-mingw32? Now it works again. Still no cigar on i686-w64-mingw32, though.
 
2
A: Efficient way to convert int to string

Lightness Races in OrbitYep — fall back on functions from C, as explored in this previous answer: namespace boost { template<> inline std::string lexical_cast(const int& arg) { char buffer[65]; // large enough for arg < 2^200 ltoa( arg, buffer, 10 ); return std::string( buffer ); // RVO w...

 
@LightnessRacesinOrbit On the other hand, volatile is quite useful in multi-threaded Java scenarios.
6
Q: volatile with release/acquire semantics

FredOverflowSince Java 5, the volatile keyword has release/acquire semantics to make side-effects visible to other threads (including assignments to non-volatile variables!). Take these two variables, for example: int i; volatile int v; Note that i is a regular, non-volatile variable. Imagine thread 1 exe...

^ don't know about C# though :)
 
@Zoidberg Dude, you want to eat your own cousins?
 
it saddens me to see foreigners "correcting spelling" in suggested edits when the original word is like behaviour
They don't even know!!
 
12:05 PM
fail
 
@Fanael wow. Remember I told you LTO is fucked up on Windows :-P?
unless you actually fixed something... that would change things :)
 
user784668
@rubenvb It worked in 4.7.
 
user142019
Hmm.
 
huh
 
> <mrout> Holy shit. open-std.org/JTC1/SC22/WG21/docs/papers/2012/n3386.html is in gcc 4.8.0
Allegedly.
> I have now implemented this functionality in GCC, and propose to add it to C++1y
Wish he hadn't. It's not fucking standard!
 
12:09 PM
anyone use the channel9 app with a nexus?
 
Ah, finally an answer that mentions visibility issues. Almost nobody believes me when I tell them "Some thread writes a new value to some volatile variable. But in C++, volatile alone gives no guarantees whatsoever that any other thread will ever see the updated value." — FredOverflow 3 mins ago
 
indeed
@TonyTheLion hehe
 
user142019
@TonyTheLion lol
 
@LightnessRacesinOrbit Merkins are foreigners now :)
 
12:22 PM
public int geti(int i)
{
    return i;
}
Just when you thought getters couldn't get any worse... (note the parameter!)
 
@FredOverflow Oh shit, you guys actually made a room named that? HAHA
 
@Mysticial Well, we didn't want to disturb the Lounge too much with our boring and repeated Java hatred ;)
 
@FredOverflow Why would it be boring?
Why would bashing Java be boring?
 
Well, it started with discussing a boring Java test Zoidberg took, and almost nobody cared except me.
He was posting question after question, and my feeling was that we should move that to another room.
 
user142019
@FredOverflow that's const specialized for this.class /* or whatever */ and int!
 
12:27 PM
@Zoidberg He even has two of them, so it's clearly not what he wanted :)
 
hi
c+++
are u guy know about c+++
 
user142019
No, we guy are not know about C+++.
 
@anandpatel gye wya
 
c+++ is the latest language created by prabhupada uvacha(baba)
 
user142019
I don't give a fuck about C+++.
 
user142019
12:30 PM
It's probably even worse than C++.
 
@anandpatel link?
 
user142019
Use a superior language, like Haskell or Erlang.
 
I want to know about C+++!
 
user142019
@StackedCrooked it's a typo
 
let me some knowlege about it.....
 
user142019
12:31 PM
lol the last sentence in that answer.
 
baba is a worldwirld.......
 
user142019
> C++, being object oriented, is marginally slower compared to C, but the code is easier to design and maintain.
 
user142019
HAHAHAHAHAHAHAHAHA yea, sure.
 
@Zoidberg how disappointing..
 
ok. i know very well...but the new concept c+++
 
user142019
12:32 PM
Use Haskell already. It's better.
 
@Zoidberg "marginally slower" aarg
 
let me diff betn c,c++ and c++
C+++
 
is this u.....na
 
user142019
What looks better, BS.unpack bytes == [0xFE, 1] or bytes == BS.pack [0xFE, 1]?
 
12:34 PM
you are good boy.....
 
user142019
Stop trolling and talk normal or GTFO.
 
ok....
please tell me fullform of GTFO
 
user142019
@FredOverflow lol
 
user142019
@anandpatel "get the fuck out"
 
user142019
lol
 
12:35 PM
fullform just.....
 
user142019
Also
 
user142019
 
ya........
not indicator
 
@Zoidberg First could be more expensive I guess
 
ok....are u from?????
dont mind
 
user142019
12:36 PM
The latter has to convert (between list and BS) only once in the program, in theory.
 
and plonk mean
u know hindi or e.t.c
 
I'd use the second one
 
ok diff between iphone and andrid
 
user142019
Adding .ignored { display: none !important; } to the chat's stylesheet makes the avatar list look so much nicer.
 
12:39 PM
nicely at eat up.....
 
user142019
> java share|edit|flag asked 4 mins ago
 
user142019
Copy paste fail.
 
user142019
I think Anand doesn't understand the Internet.
 
why ...
but please tell me.....
bye
 
@Zoidberg You know that is a great idea
 
user142019
12:43 PM
Of course it is; it's my idea.
 
That's why it wasn't obvious it's a good one
 
Ell
Gawd babies are stupid
 
their brain is the size of a slice of banana
of course they're stupid
 
Ell
Haha
 
Sometimes they even stay that way
 
Ell
12:45 PM
yeah, its annoying :L
 
baby can't even come defend himself
you bastard
 
he can throw up all over you, though
 
user142019
template<class T, std::size_t N>
class nton {
public:
    nton() = delete;

    T& get_instance(std::size_t i) {
        return instances[i];
    }

private:
    static T instances[N];
};
 
nice
 
user784668
12:53 PM
@Zoidberg Second one.
 
then we can effectively prevent anyone from using the nton identifier for any purpose, useful or not
 
@Zoidberg How about making that get_instance a member template, so wrong arguments are caught at compile-time? :)
 
user142019
Doesn't work if i isn't yet known at compile-time.
 
Sure, but I assume that a user knows which instance he needs at compile-time.
 

« first day (840 days earlier)      last day (4094 days later) »