« first day (945 days earlier)      last day (4001 days later) » 

9:00 AM
@ChristinaBrooks The resources handled by RAII are also usually on the heap.
 
Yeah.. o_O
You wouldn't use RAII on something with automatic duration
 
6 hours ago, by DeadMG
yay I finally have le internets again
you were cut off from Internetz?
 
@StackedCrooked Not in an interrupt-handler, no, (apart from trivial POD types with no destructor).
 
@Rapptz int handles are automatic...
 
Anyway gonna sleep.
 
9:01 AM
@MartinJames Top halves are usually written in C or asm and then handling is (usually) deferred.
 
@Rapptz Good, uh, morning? :)
 
@TonyTheLion yuppers
 
@Rapptz where are you in Murica?
 
Michigan
 
@ChristinaBrooks Yeah. Some architectures are more complex than mine :) I have only one 'top-half' for all my drivers.
 
9:02 AM
@Rapptz oh right
 
@MartinJames Well, if you don't need cleanup, then you don't need RAII.
 
RAII wouldn't work if you're returning a pointer, would it?
 
@MartinJames All POds are trivial! All POD structs have destructors!
 
@ChristinaBrooks It would.
 
Hm.
But the thing is, mutexes are not acquired for function scopes.
They're acquired "whenever"
And released "whenever"
One function may acquire and release the same mutex around 20 times.
There is a good reason for that.
Because the mutex is only held when it needs to be held.
Not when it's convenient for the sake of the code looking cleaner.
 
9:06 AM
It's not about cleanliness. It's about safety.
 
Locks take care of, well, the locking in C++.
 
@StackedCrooked Is not writing extra code not an act of cleanliness?
 
@MarkGarcia Using RAII often means less code.
 
I don't like magic.
Explicit allocation should be followed by explicit deallocation.
 
@StackedCrooked Then that's it. Less code is cleaner than more code. We love RAII!
 
9:08 AM
You might disagree with me.
But everyone has opinions.
 
@ChristinaBrooks Programmers used to say that about virtual methods when they were introduced.
 
alright
 
@DeadMG woah, must have sucked.
 
who here has a Reddit account?
 
Xeo
9:08 AM
Rapptz
 
@ChristinaBrooks You should try it. Apart from your work.
 
you can just make one, quite easily
 
@TonyTheLion It did. I had to watch Terminator 2 three times consecutively to pass the time.
 
I have one
 
you don't even need email
 
9:08 AM
I do indeed.
 
@DeadMG that's terribru
 
Oh god, I just read my comment history.
 
@DeadMG I always have some spare anime on my disk in case of emergency.
 
@ChristinaBrooks It's boring boilerplate that lessens the signal to noise ratio.
 
9:09 AM
> Welcome to the filthiest code subreddit there is, where no information are encapsulated.
but..
 
@StackedCrooked If he doesn't have internet, he can't come here and ask you.
 
Xeo
@LucDanton Not to mention it being highly error-prone.
 
@TonyTheLion I have it for myself, silly :P
 
oh lol
 
9:10 AM
s/magic/abstraction
 
I totally misinterpreted that. :/ failings by The Lion.
 
@StackedCrooked I have various amounts of entertainment ready in case of catastrophic Internet failure.
 
@ChristinaBrooks that's just a convention that you are used to. it's not a universal principle.
 
but generally, it was unexpected and I was in the middle of pwning some noob on Starcraft 2
 
My worst fear would be hardware failure.
 
damn link syntax
 
Xeo
@Pubby lol
 
DeadMG has 2 upvotes!
 
> sorry, this has been archived and can no longer be voted on
 
9:12 AM
lol
 
I couldn't even upvote it :/
 
Xeo
> submitted 6 months ago
Well
 
oh wow
 
lol
 
I didn't even look at that
 
Xeo
9:12 AM
So much for feedback? :P
 
You should have posted on /r/cpp
Okay sleep time.
 
ohai @kbok!
<3.
 
oh noes, telkitty is back
 
banhammor
 
lol
Feel free to bin it
 
9:24 AM
Meh - leave the stacked/heaped cats. There are worse animals.
Oh... I see that the worse animals have made it to the room topic :((
...and a Cat was responsible for it.
OK, bin the cats.
 
I allocate my resources mostly on the stacked and sometimes on the crooked.
 
Anyone tried the new modularized Boost repos?
 
What is there to try? I hope it doesn't involve messing with bjam.
 
Moving away from subversion to git.
 
Building from trunk without the hassle of SVN I suppose?
 
9:37 AM
There's really an svn exodus happening.
 
Eh, looks a bit too early.
Damn, can't browse the docs of Boost.Log online. Would have liked to check what's in it.
 
I'm also surprised by the choice for CMake. IIRC SCons was considered superior.
 
Can still browse some example code.
 
Boost.Log looks interesting.
 
Xeo
@LucDanton Not sure I like how setting up the logs / sinks is done
 
9:48 AM
@Xeo On the one hand it is indeed a bit of a shock reading it the first time. If, OTOH, I can just have setup_logs(argc, arv); in main and have the code somewhere (with presumably the hairy includes that bring the EDSL(???why???) for describing stuff only there) then I could be very happy.
 
I was tasked to design a new logger at my work place. It looks suprisingly similar to boost log.
But with much reduced feature set.
Only 4 log levels and one output channel. That's it.
 
Hm.
Guys, if you have a function that checked for changes on Disk and reloaded any resources that had been re-saved on Disk,
what would you call it?
Refresh ?
 
reload, refresh, update, ...
 
Ah. My first instinct wasn't so bad then.
 
reload_disk
 
9:54 AM
I didn't want to do Reload because there's already a Reload function. :P
Refresh works out well.
 
Xeo
sync_{to, with}_{disk, source} :D
 
I guess it's not the EDSL in and of itself I'd object to. It's the part where it's an EDSL that mimics the interface of streams. So it's futuristic, but with io manipulators. Bleh.
 
@ThePhD meh, stateful code :(
std::unique_ptr<disk_view_t> disk_view;
disk_view.reset(new disk_view_t(path));
 
Xeo
@LucDanton It seems restricted to streams too
 
@ThePhD That seems like a confusion api.
 
9:56 AM
You can use Boost.Iostreams to adapt anything to the streams interface. So it seems only fair.
 
Xeo
Although I wonder if you can just declare your own operator<< for non-iostreams and have it work
Since not everybody likes the i/ostream hierarchy
 
Would you prefer operator<<(ostream&) or a to_string overload?
Ok, they are orthogonal.
 
OTOH I can use Boost.Format syntax.
 
Hi guys
 
Hi kbok.
 
10:03 AM
I have a quick question
 
Yay, rotating log functionality out the box, probably.
 
In svn.boost.org/svn/boost/trunk/boost/regex/v4/…, parser_buf::parser_buf() calls setbuf() which is virtual
That's UB right?
 
Xeo
Not UB, but you don't get virtual dispatch, IIRC
It's UB if it's a pure-virtual, though. I think.
 
So no vtable lookup if called from constructor? That's a strange logic.
 
Are these rules in the standard?
 
Xeo
10:06 AM
@StackedCrooked There is no derived vtable yet, remember
 
i know.
 
Xeo
So vtable lookup is happening, but there's only your functions
Not the derived ones
 
@kbok 12.7 & other places.
@Xeo That's ambiguous.
(The way you've put it.)
 
Xeo
6 mins ago, by Xeo
So vtable lookup is happening, but there's only your functions
Does that disambiguate it?
 
Ye.
Btw the rules are nice in that this happens regardless of how the call is made -- it doesn't matter whether it's through this or not, as long as it refers to the object under construction (or destruction).
 
Xeo
10:15 AM
ya
 
'Dynamic type as if it were the class of the constructor/destructor' is the concise way to put it I think.
It's weird. I find the rules more arcane than pointer conversion rules but I'm less afraid of calling a member in a constructor than I am of converting e.g. this.
 
Xeo
heh
 
Lol
God
Looking at thsi coliru I feel so sad
Why, C++, why? ;~;
 
But multiline output works!
 
If you just banned this... ... all problems would be solved. ALL PROBLEMS.
@StackedCrooked That does not heal the hole in my heart over C++ and it's parsing issues. =[
 
10:21 AM
If you are a C++ programmer you always have something to look forward to (the next standard).
@ThePhD Why is that a problem for you?
 
It's the root of the function declaratiosn vs. constructor issue!
 
yiz
Anyone here know hows to get my perl cgi talk to my PHP through GET request?
 
Being able to just willy-nilly declare a function (but not a definition? Seriously?) in another function is the asinine parsing nonsense that leads to the introduction of new language syntax (like {}-initialization and construction).
To date, I have not found code that uses the in-a-function declaration syntax, nor written in-a-function function declarations myself. It seems like an utterly useless feature, at this point.
 
Xeo
Blame C
 
=[
Goddamn C.
We just need ++.
 
10:40 AM
Question.
 
Xeo
answer
 
Should a framework ever take the responsibility of handling the main while() loop ?
 
Don't most GUI's do that already?
 
Xeo
room topic changed to Lounge<C++>: .NET is Not Even Trying [c++] [c++11] [c++-faq] [no-helpdesk]
 
Ooh, that's good.
 
10:42 AM
I think this is a magical lookup. (It finds a function that is not yet defined.) And it only works if func is a function template.
 
It gets the p***** stuff off, anyway.
 
@StackedCrooked template functions delay their definition until the last possible moment, It hink.
Though, see!
That proves it!
C++ has the ability to forward-declare shit by itself!!
 
@ThePhD Instantiation happens in the body of main. At that point the function is still not defined.
 
WHY DOESN'T IT DO THIS NATURALLY?!?!?!
 
Xeo
@StackedCrooked My Little Templates: ADL is magic
 
10:48 AM
0
Q: Why does the compiler find my function if is not yet defined?

StackedCrookedContrary to my expectations, this program works: #include <iostream> namespace a { struct item{}; } namespace b { struct item{}; } template<typename T> void func(T t) { do_func(t); } int main() { func(a::item{}); func(b::item{}); } namespace a { void do_func(item) { std::cout <<

I figured this may help to get my 10k :)
Saturday noon is probably the worst time to ask tough :)
 
In reference to he question stackoverflow.com/questions/388242/…
have any one ever went through books.google.co.in/books/about/… book
?
As I wanna add it as an answer to that discussion
 
Xeo
@StackedCrooked I would say "declared" in the title
 
done
Is it even standard behavior?
 
damn
I wanted to play FF8 but couldn't get a copy that would work on my PC
 
A possible explanation would be that the compiler performs a first pass to find all function declarations and a second pass to process the inside of the functions. But then it should also work if func was a normal (non-template) function.
 
10:57 AM
Because the compiler is smart! — johnchen902 26 secs ago
^ I like this answer.
Aren't templates a two-phase lookup anyhow?
 
yes, but not like that.
 
I guess GCC is just being nice.
 
Variation (these are not so surprising anymore)
 
TBH I'd just call this a compiler feature and call it a day.
 
11:04 AM
argh
stupid Windows
how am I going to terminate the problematic process if you put the fucking task manager off screen?
 
Easy; navigate the entire thing blindly using your keyboard.
Ezpz noproblem.
 
Strange - every time I start the task manager, it seems to be on-screen.
@DeadMG Oh - hang on, is this stupid Windows 8?
 
no
 
Can I make a lambda's function non-const?
Or does it have to be const?
 
> My answer still stands though, template instantiation is performed after reading all of the source
 
11:17 AM
It's probably so that ADL doesn't do funny stuff and call the wrong functions if you forget to declare them
 
Yeah, looks like it holds up if the argument is a user-defined type.
So it has to be ADL interfering.
If you remove the namespacing from item it doesn't work anymore.
And if you remove the namespace from around the func, it doesn
't work anymore.
 
Yes, I originally stumbled upon this when toying with adl.
 
HAH
SO I WAS RIGHT
IT WAS TWO-PHASE LOOKUP AND ADL
AHAAAAAAAAAAAAAAAAAAA
/c++expert
Is it possible to demand that my values are not captured by const value?
Man, I should've answered that question.
Free rep. =[
 
no shit sherlock
:P
 
;~;
Hm.
But, seriously.
It seems the lambda is always capturing my variables by const value or const reference.
How do I demand it captures it as-is?
 
11:31 AM
You need perfect forwarding for that.
 
Xeo
@ThePhD [](...) mutable
For non-const value
or rather, non-const operator()
 
I think mutable is a weird feature.
You could just use a static variable inside.
 
Xeo
uuh... lambdas are copyable, y'know.
 
They are?
lol didn't know that
 
user142019
I'm going to make a small actor library for C++.
 
user142019
11:37 AM
With stuff like Erlang's supervisor and gen_server.
 
you like starting projects, don't you :)
but that's cool
 
user142019
JA :D
 
Ell
@StackedCrooked you only just noticed? ;)
 
i had my suspicions
 
user142019
I want concepts. :(
 
11:47 AM
I want variadic templates. =[
 
user142019
Then you don't want MSVC.
 
I know. =[
But I also want Windows, DirectX, PiX, and the VS Debugger. q_q
 
Ell
@rightfold have you tried gcc with concepts lite?
 
user142019
No.
 
Ell
howcome?
 
user142019
11:50 AM
Because I didn't know it existed.
 
Ell
It's experimental, though
 
C++11 features that have let me down:

constexpr
std::initializer_list
uniform initialization
alternative function syntax
enum class
user defined literals
multithreading
attributes
tuples
Anything else to add?
 
Ell
lack of make_unique? :P
@Pubby what let you down about this stuff?
 
@Ell I dunno. Too much too go into.
 
enum class can't have methods on the enum itself (why bother with the class/struct part then)?
 
Ell
11:52 AM
@ThePhD compatability?
 
enum class isn't meant to be compatible.
It's got a new keyword.
So it should have new functionality.
 
And I prefer unique_ptr<T> take_unique_own(T*) over make_unique
 
I should be able to define enum-methods
 
Ell
@ThePhD what's the new keyword?
 
enum class MyFlags {
....

bool IsOfThisSpecificStyle(); // `enum` acts almost exactly like a regular class, with definable methods and such.
};
@Ell enum class.
e.g. class
enum class is a different breed of enum
 
Ell
11:54 AM
there are no new keywords there
 
Enum class added basically nothing but more verbosity
 
@Pubby All the wrong things, and no benefits.
 
Ell
Having to fully qualify is a benefit imho
 
Oh, I forgot to add perfect forwarding to my list
 
I like scoped enumerations because they allow for strongly typed integral types...
 
11:55 AM
That's a benefit, sure, and being able to name it like a regular type is good, sure.
But I would have also preferred MyFlags.HasThese()
 
enum class hours {}; template<> struct is_arithmetic_enum<hours>: std::true_type {}; kind of deal
Then you can hours { 3 } + hours { 5 } but not hours { 3 } + 5 :v
 
@LucDanton Can't you do struct hours { int value; }; instead?
 
@Pubby Ye. It's a bit more verbose and I'd have qualms about where to put the operators though.
 
Seems like .value would be less verbose than the weird enum casting stuff.
 
@LucDanton To be honest I'd prefer to be able to use member-function syntax on enums.
 
11:58 AM
I have to_underlying(h) but that could work just as well for any concept, doesn't have to be about enums. (I would call it something else of course.)
 
@ThePhD struct myenum { enum myactualenum {} value; void memberfunc(); }
 
@Pubby OTOH the whole point is to leave hour values in the hours type.
 
@Pubby That's just ridiculous. =l
 
@ThePhD ...because giving enums member functions is ridiculous
At least it's not python enums
 
@Pubby It's not. Not that I've ever needed some though.
 
12:00 PM
Member functions on enums aren't that bad.
 
Why does it make sense to have non-member operator+(E, E); and no operator() or whatever?
 
Why would an enum have operator()?
 
user1182183
someone knows an alternative for this for Windows 8 x64?
 
user1182183
Specifically this part:
 
user1182183
> For example, if you have built-in sound card and SoundBlaster as second sound card, or USB/Bluetooth headset, you can configure certain applications play on built-in sound card, and others play on SoundBlaster or USB headset, fully employing your audio hardware.
 
12:03 PM
... Uh.
 
@Pubby The point is that of inconsistency, not that I or anyone would need anything.
@Pubby That is a terrible argument. Why would anyone need operators?
 
@LucDanton Yeah, I see your point. I'm just arguing for the sake of arguing.
 
Let's just have functions and data.
@Pubby >:(
 
Meh, enums were added for enumerating constants, not defining new types.
 
No. That's what you want.
 
12:04 PM
What?
 
Constants.
 
I want Functions I can call on my constants / data. <3
 
I want constants!
I want my program to finish running before I even compile it
that way I could solve my problems before they existed
 
yiz
A day old, still an interesting question (for lazy bums who don't like to type even an extra character if they don't have to):
0
Q: Must type template every time for generic functions?

DuncanIn C++, is there any way to avoid having to type the template name every time I am writing a class function outside of its class definition? For example, if I want to define a class function, do I have to type type template <class T> before every single function? It seems like a lot of unnecess...

 
@Pubby Nearly every year, one or more people would submit what they claimed
was the world's smallest self reproducing program. While the sizes
of these submissions varied, a quick glance would reveal that they
were too big, until this entry came along.... http://www0.us.ioccc.org/1994/smr.hint
 
yiz
12:08 PM
@Abyx omg omg omg <3
 
@Mikhail hehe
 
@yiz wat?
fuck off then
 
@yiz If he didn't want to type an extra character he should remove the space between template and <.
(it's the equivalent to writing functions like void foo (int x). Yuk. )
 
yiz
But then you would have to implement it for all types which defeats the purpose of a template
 
@Pubby void foo ( int x ); <3
 
user142019
12:16 PM
 
user142019
"try" y u keyword.
 
@rightfold I like the structure of those unit tests.
catch is nice
 
user142019
I made receive a functor so you can't receive from other actors.
 
user142019
I'll simply document receiving from other threads as UB (since you can pass around the receive functor).
 
user142019
I could also make it throw, actually, by checking the thread ID.
 
12:21 PM
The receiver is kinda weird though.
It directly accesses the internal queue of the actor and pops the messages.
Shouldn't it be the actor that dispatches the messages to the receiver?
 
user142019
receiver is just a proxy.
 
user142019
Instead of having actor::receive().
 
user142019
So you can't receive from other actors.
 
yiz
anyone here knows perl?
 
user142019
Maybe I should just pass the actor to the callback and throw if you receive from the wrong thread.
 
12:34 PM
Try to make it a compiler error if possible.
 
user142019
That could be done using protected and inheritance.
 
user142019
(Which really sucks. :v)
 
user142019
Well, you know. If you don't pass receivers to statics and you don't send them to other actors you can't fuck up.
 
user142019
And assigning them to statics would require using a pointer or something like that since they're not default-constructible.
 
Thanks to Nawaz I realized this.
 
user142019
12:41 PM
C++ overload resolution really is the most complicated thing in the world.
 
@StackedCrooked What's item{}?
 
user142019
@Jeffrey Not a built-in type.
 
@Jeffrey it's a struct which is defined on line 3
 
@StackedCrooked is it, specifically, an initialization?
 
it's a definition on line 3, and on line 10 it's a initialization
 
12:53 PM
Then what's wrong? What were you expecting?
 
I learned that do_func is found thanks to ADL. And that line 11 won't compile because int is a builtin type, and ADL doesn't work on built-in types.
 
TIL std::endl is a function pointer...
 
Ell
wtf javascript. $("html") -> this element is not present on the page
 
Uh.
Hey guys, question about std::unordered_set...
If I have a std::unordered_set<boost::any>, and I want to .find() the first any with a specific type_info .... is there a way to do that?
Atm, it keeps taking a key_type, and the key_type for an unordered_set is... well, it's any.
 
user142019
12:58 PM
Why are you using boost::any?
 
@Jeffrey No it isn't
template< class CharT, class Traits >
std::basic_ostream<charT,traits>& endl( std::basic_ostream<CharT, Traits>& os );
 
user142019
std::endl is a function.
 
this is not a function pointer
 
@rightfold Unknown run-time storage bin.
 
user142019
It can decay to a function pointer.
 
12:59 PM
yea
 
user142019
> Note that std::endl is a function
 

« first day (945 days earlier)      last day (4001 days later) »