« first day (1376 days earlier)      last day (3577 days later) » 

12:12 AM
I am so upset these a few days I am going to throw myself into a dark abyss this Saturday and feel the free fall for a ... split second. Advanture caving <3 <3 <3 ... even though the excitement has temperarily left me and anxiety takes hold
 
> 1 < false.
true
I like Erlang already.
Ok, pattern matching is pretty cool in Erlang.
 
12:28 AM
@Jefffrey you can now rename to rightfffrey
 
rightfffold
The point is that I'm not liking gazillion of other things.
 
give it time
 
strings are worse than char* in C++
they are simply retarded
the convention appears to be to always have 2 letters function names.
and so on
 
its worse than strrchr?
 
> [97,98,99,4,5,6].
[97,98,99,4,5,6]
> [233].
"é"
> Erlang will print lists of numbers as numbers only when at least one of them could not also represent a letter!
 
12:34 AM
That's its telecom history for you, they didn't need strings so they got bolted on
 
@Jefffrey O.O what
thats fucking dumb =/
 
what shall I get my next degree in?
 
Celsius
 
smooth
 
Hi. Can I use some help to decrypt this sentence: "...before a definition is seen, the class type is incomplete type".
Does "before a definition is seen" mean the closing "... };" of a class def?
 
12:48 AM
class X; is a class declaration (incomplete type). class X { ... }; is a class definition/declaration.
or something like that
 
@Jefffrey Thanks. To confirm, before the class definition ending curly-brace, the class is not seen yet, correct?
 
wat
seen by who?
 
@Jefffrey seen by compiler.
 
that doesn't make any sense, son
 
that's not a property of the compiler
that's the linker
the compiler only cares if things are syntactically valid
 
12:51 AM
@Jefffrey Let me quote the context.
"After a declaration and before a definition is seen, the type Screen is an incomplete type - it's known that Screen is a class type but now known what members that type contains"
- C++ Primer, Class Declarations
 
I think I've heard that book is shit.
 
Nope
C++ Primer Plus is
 
@burrito Anyway, it means that if we have class X; <A>; class X { ... }; then in <A> the type X is an incomplete type.
<A> being a set of statements.
 
@Jefffrey I see. Thanks. I was just trying to confirm that within the class body, i.e. the ellipse part in class X {...}; is also incomplete type
 
The point is that you have an incomplete type when you haven't defined a "body" for the class. This is pretty much only relevant when you are trying to avoid some weird circular dependencies with pointers and/or references.
 
12:56 AM
@Rapptz Uh no
 
I was simplifying
 
@burrito No, it isn't
 
:v
 
You can't simplify to the point where it's bullshit
 
Well, it's not completely false.
Outside of object file generation being left out.
 
12:57 AM
@burrito I doubt that will ever be relevant. I dunno. I'd have to read the standard.
 
@Jefffrey like create a member of that class type before its body ends
 
And it's 3am. Sorry, I'm not going to do it.
 
Compiler does syntactic and semantic analysis
 
@Jefffrey I see.
 
@burrito I'm pretty sure the order in which you define the functions / members is irrelevant within the class body.
IIRC the member lookup is class wise at any point in the class body.
If that makes sense.
Actually it doesn't.
Welp.
 
12:59 AM
@CatPlusPlus Do you mean that within the class body, that class is complete?
 
Yes
Otherwise you wouldn't be able to define inline members
 
@Jefffrey Then I am confused by this case: class T {T memb};
 
That doesn't compile
 
Shall it compile
And the reason is ...
 
That type is infinite
 
1:00 AM
^
 
It has infinite size and it can't physically be represented
 
What I mean before is this.
 
Nothing to do with incompleteness
 
@Jefffrey I see.
@CatPlusPlus Ok that is one interesting perspective
 
I'm glad, because I'm basically rumbling nonsense at this point.
 
1:06 AM
just fav'ed that question
Anyway, originally I was decrypting the wording based on a thought that one person does not "see" a thing/definition until he finish the last character of it.
that was too language-lawyer, wasn't it?
 
That'd be true for a single-pass compiler, but C++ has requirements that make single-pass impossible
Meh got paper cut from the tea box
 
Put it mildly: C++ sucks.
 
Nobody does single-pass
 
lol
 
It's terrible and annoying for language users
 
1:09 AM
Go use Haskell, Erlang or whatever
 
so whats the trend now
 
C++ sucks anyway, though, because it still keeps single-pass artefacts, like declarations
 
I heard about Scala, is that good?
But Haskell has no oob, right?
 
I'm not confortable with saying "language <x> is better/worse than <y>" anymore.
 
Scala tries to be too many things at once
 
1:10 AM
@burrito Yeah, turns out OOP sucks too. So, there's that.
 
C++ tries to be a lot of things too.
 
interesting point
 
my advice is to not take any advice about what programming language to use on the internet
go with whatever
no one cares
 
user3010322
> go
 
user3010322
I see, I see.
 
1:12 AM
but try different paradigms FFS
OOP is not everything
 
good to know. I heard FP is fun
 
by a long shot
 
Whatever you do, don't learn Haskell. We have enough annoying fanbois in the room.
 
lol
 
indeed
 
1:13 AM
@R.MartinhoFernandes I "learned" haskell and I'm not a fanboy =/
 
@burrito Yeah. I suppose so.
 
oh come on
 
ok. i'll go back to C++ reading. thx for all tips
 
hf
 
user3010322
gl
 
user3010322
1:14 AM
You'll need it.
 
@burrito don't get naked either; we have too many nudists in the room.
 
I'm topless
3
 
I'm... yeah.
 
lol
 
I'm actually wearing some clothes ATM.
 
1:15 AM
Me too
 
might sound weird but me too
 
@R.MartinhoFernandes Its not your fault you keep forgetting your clothes money at the ATM
 
Mine was better
 
@Jefffrey Weirder by the hour..
 
he forgot money at the ATM?
ikr
 
1:17 AM
@R.MartinhoFernandes I've stopped being surprised
 
Oct 13 '13 at 18:19, by R. Martinho Fernandes
@Borgleader Nothing. I left some cash at an ATM.
 
How to align a local union variable to a 16 byte boundary? declspec align(16) works for Visual Studio. __attribute ((aligned(16))) is not working for gcc 4.4.
 
lol dumbass <3
 
shit
I need maybe_delete
 
Nudity is banned in my office. The ban is enforced by my disintegrating office chair with it's sharp bits of plastic covering.
 
user3010322
1:20 AM
@Rapptz :3c
 
@Rapptz What's that?
 
optional ownership
 
@excray no shit that's CL specific syntax
 
user3010322
@Mgetz Pay attention to the __atribute ((aligned(16))
 
@Mgetz Shouldn't attribute ((aligned(16))) do it for gcc
 
user3010322
1:22 AM
Either way, I don't know the right syntax for GCC.
 
user3010322
Why don't you look it up?
 
@Rapptz You mean boost::optional + ownership?
 
boost::variant<std::unique_ptr<T>, T*>
 
user3010322
Lol.
 
1:23 AM
oh wow
 
I don't think you can enforce alignment of structs inside a union
 
@Rapptz o.o why do you need that?
 
don't judge me!
 
that's determined by member alignment
 
@Rapptz we are here to help you
 
user3010322
1:23 AM
I already had that exact same thing.
 
@Borgleader Uh. User can use an already existing thing, or I could provide it
 
user3010322
Except it was std::unique_ptr<T, maybe_delete<T>>
 
@ThePhD It is not a syntax problem.
 
@ThePhD How would that work? :v
 
user3010322
std::unique_ptr<T, maybe_delete<T>> meow( ptr, { false } );
 
1:25 AM
works for me
 
user3010322
For usage with all deleters...
 
I'm willing to think of a different design though
I guess I could technically store two pointers
 
using maybe_delete = std::unique_ptr<T, boost::optional<std::function<void(T*)>>;
 
nah
ThePhD's idea is surprisingly decent
 
hahaha awwwww surprisingly
 
user3010322
1:29 AM
template <typename Dx>
struct maybe_delete {
     bool do_del;
     Dx del;
     template <typename... Args>
     maybe_delete ( bool should_delete, Args&&... args ) : do_del( should_delete ),  del( std::forward<Args>( args )... ) { }

     template <typename P>
     void operator () ( P&& ptr ) const {
          if (do_del) del( ptr );
     }
}
 
@Rapptz Take ownership then
Or don't at all and let the user worry about that
 
user3010322
@Rapptz Hey! D:
 
@CatPlusPlus By provide, I meant an l-value.
Like ptr = &val
 
Yes your API is weird I got that
 
:v
it's transparent
@ThePhD :v
 
1:33 AM
@Rapptz The unique_ptr doesn't really own anything there, which is a bit contradictory. The variant is clearer in that there is nothing owned by using a raw pointer.
Using a unique_ptr for non-ownership is abusive and something I wouldn't pass on code review.
 
I'd question the design that lead to this
Well, I already did
:v
 
like I said
I could just do T* val; std::unique_ptr<T> stuff;
 
user3010322
Well, boost::variant is header-only so it should be easy to include and use it that way. :D
 
That's just like a poor man's variant.
 
this poor man has no variant
 
1:35 AM
Good morning.
 
@R.MartinhoFernandes You mean the name?
I guess
well
still don't know what I'd do
lol
 
Yeah, @Xeo sucks.
 
Do you also think std::unique_ptr<void, deleter> is bad?
 
If it's owning, no.
 
I guess I could rename it to an alias
like optional_ptr or something
 
1:41 AM
Assuming you want type erasure.
@Rapptz Alias the variant, then.
 
I don't have a variant ._.
 
whistles
"But I don't have a screwdriver!"
 
@Rapptz doesn't like ~~dependencies~~
 
I haven't put any dependencies on Gears yet :s
I don't wanna do it now
 
@Rapptz likes ~~control~~
 
user3010322
1:43 AM
Don't worry @Xeo I agree with you. <3
 
making a variant is on my todo list though
 
@ThePhD I think that will worry him.
 
user3010322
:c
 
@R.MartinhoFernandes lol
 
user3010322
WELL FINE I HATE YOU @XEO. D:<
 
1:44 AM
k anyway
I spent 30 minutes debating this
When I could have done something else =[
I'll just alias the pointer for now
make it clear it's not "unique" ownership
 
Disappoint.
 
just "weird" ownership
@R.MartinhoFernandes :(
 
user3010322
Variant is the same thing, just isntead of using a bool you're constructing it with a raw pointer or a unique pointer.
 
@ThePhD So.........?
 
template<typename T, bool should_delete>
struct maybe_delete { T* t; // ... sfinae that bitch for deletion };
 
1:47 AM
You just said it's the same thing!
So why would you prefer the one that abuses unique_ptr?
 
@Borgleader you should learn about template specialization :)
 
user3010322
Because no variant. vOv
 
Variant doesn't break the expected semantics of things like .reset().
 
@StackedCrooked I should learn about templates period =/ I suck T_T
 
It's not all sfinae.
 
1:49 AM
hm does maybe anyone by any coincidence know what QT uses for networking on windows? Not WinSockets because detouring them yields 0 results :')
 
user3010322
If it doesn't need deleting, then .reset will do exactly what it's supposed to? (i.e. just set a new pointer underneath).
 
@ThePhD And not destroy anything, because the pointer doesn't actually own anything.
 
user3010322
Yeah... reset's invariant's are based on the deleter. ... And the deleter is maybe_deleter. :3
 
all other alternatives just end up with more work for me
outside of variant/maybe_deleter
I was thinking of storing two pointers or making the non-owning case a different class
 
8 mins ago, by R. Martinho Fernandes
"But I don't have a screwdriver!"
 
1:51 AM
@Rapptz I vote for the different class.
 
user3010322
Yeah. But if it's an implementation detail, it's plenty forgiveable.
 
:| C++ is weird sometimes
 
Yeah, yeah.
No one ever looks at implementations.
 
I do.
I know the question is rhetorical
 
Twas sarcasm.
 
1:52 AM
I'm just saying ThePhD's statement would make me look kind of hypocritical
 
user3010322
vOv
 
@MarkGarcia Yeah. I guess.
 
user3010322
@StackedCrooked Yeah, but that becomes hard to store when you need to store both.
 
It's not too bad.
But it doesn't really scale well
:/
btw this is what I'm doing:
2 days ago, by Xeo
@Rapptz Hm, internal option storage? I like how Boost.PO writes directly to variables you give it.
Trying to make that work
 
user3010322
1:54 AM
Wait.
 
user3010322
Why don't you just have optional<T> ?
 
0
Q: How to insert 100G integers into a vector on a 32-bit machine?

xmllmxSay I have 100G integer numbers and want to insert them into vector<int> on a 32-bit machine, is it possible? If I use custom allocator to manage the storage strategy, how to guarantee the following operation is always valid: (Note that the C++ standard requires the objects stored in a vector m...

^^ lol
 
@ThePhD Because that's something entirely different?
 
@ThePhD I'm not sure how it applies.
 
user3010322
if ( storage )
     *storage = value;
else if ( external != null )
     *external = value;
else
     throw std::exception( "What the hell, bro." );
 
1:56 AM
que
 
@ThePhD If you're going to use two storages, just use the pointers.
They already have nullability builtin.
 
user3010322
Oh. Sure, why not.
 
At my first workplace (2005-2007) they had an AutoPtr that stored a pointer and an ownership flag. It would only delete the object if owns=true. Also copy would transfer ownership to destination object.
 
clusterfuck_ptr
what's the least evil way to do this w/o using variant?
 
Two pointers.
 
user3010322
2:00 AM
One unique pointer, one regular pointer.
 
user3010322
That's about as easy as it gets.
 
user3010322
I think I prefer optional<T> though
 
user3010322
because it means you don't have to new the storage.
 
using optional<T> for this seems worse than maybe_delete
 
user3010322
It's just optional<T> internal; and a T* external
 
user3010322
2:02 AM
if ( internal ) *internal = value;
if ( external ) *external = value;
 
user3010322
vOv dead simple
 
if I didn't want to use std::unique_ptr I could do it how Boost.PO does it and just store the values in any
which seems weird to me tbh
 
user3010322
<.>
 
Is [C++] SO just as overrun with questions of the "My program crashed! I got this error! Here is my code: <hundreds of lines of shit>. Halp!" variety as [C]? They should just be immediately closed, as far as I care. I mean, the 1st thing to do when learning a low level language (okay, maybe the 2nd) is to get really familiar with your debugger. Haven't fucked your debugger yet? Then don't fucking fuck with SO yet either.
 
ok
 
2:07 AM
@Will Probably not as much. Given the recent language evolution the space for decent questions has expanded.
Though, yes, it is going downhill.
 
C++ tag does a decent job at cleaning up itself
at least
 
Hmm, I see. Good to know.
 
wtb std::combine_hash
 
@Will As I can see, most of the questions you said are ignored. It's still a bad thing though as people help people like themselves.
@Rapptz hash_combine
 
To be honest, it's been a long time since I stopped lurking .
And I've almost given up on too.
 
2:13 AM
@MarkGarcia My problem is mostly that finding anything interesting or useful is like searching for your email among all the spam in your inbox back in 1999, before filters actually worked...
 
It has come to mind mind at times on what if Stack Overflow would do it all over again, from the start, clean-slate.
 
user3010322
The same thing would happen again.
 
@ThePhD Yes, and we'll do it again.
 
What if SO used more moderation bots like Wikipedia? And was a bit more picky about the kind of questions it allows? SO shouldn't just check if a question was asked before, but also if a question is formulated well enough that it could ever be of use to anyone other than the OP. All the "my code is broken" questions surely are not.
 
bad idea
there's no way to automate that stuff sanely
Wikipedia bots work on algorithms that detect massive deletions or massive additions with low contributions or random IP
We already have the equivalent of the Wikipedia bots through human reviewers (though they do a somewhat poor job)
 
2:23 AM
This book has a nice introduction to boost mpl.
 
That's what I meant. Tentative flagging followed up by human checking.
 
We already have that.
You don't have enough rep to see the review queue though
 
Then it's not working properly.
Or the criteria used should be altered IMO.
 
The review queue has been a topic of debate for a long time
 
Anyway, what about the second point I brought up? That all the my "code is broken" questions should not be allowed on the basis that they serve no purpose for anyone other than who asked the question.
 
2:28 AM
The people who pushed and taught them programming are the ones to blame.
That includes no-good books.
 
those are closed quickly
 
Not in [C] they aren't...
 
sucks
cleans itself up pretty decently
we're kind of harsh around these parts apparently
 
user3010322
KEYBOARD SHIPPING FROM CHINA.
 
2:41 AM
k well
this two pointer thing makes things a little more annoying
I have a class named value_type
feels uncomfortable
not sure what else to call it though
 
3:15 AM
For future non-10k users
Since it's one delete vote off.
Oh lol, they ninja-edited out the evidence of it being late and the test saying to do it in good spirit.
 
user3010322
3:36 AM
I wonder if function_traits should proc on member object pointers...
 
user3010322
.... Nah, I'll just add some extra std::conditionals
 
user3010322
@Rapptz Semantic question.
 
user3010322
C++, when you set a member variable (or any variable), returns itself to allow for "chaining"
 
user3010322
Should we try to achieve the same in lua?
 
no
 
3:56 AM
@ThePhD or any variable?
 
I wonder if doxygen can parse explicit template instantiations sanely
The question on SO asking got closed for "primarily opinion based" lol
3
Q: Doxygen'ing different instantiations of a templated function?

einpoklumI have template <typename T> foo<int, T>() { ... } template <typename T> foo<T, double>() { ... } And I want the foo() function doxygenated. What is the appropriate Doxygenation practice for such cases? Doxygenate both functions? The first? None? Use a common more general header and only docum...

 
user3010322
@StackedCrooked Basic chaining: coliru.stacked-crooked.com/a/0650b2d15c782b06
 
user2953119
Hi! Has anyone tried to looking for a job on carreers.stackoverflow?
 
4:13 AM
I haven't but I've received job offers if that counts.
Which I guess means that employers use it :v
 
user2953119
@Rapptz You had posted your CV on carrers or employer had found you?
 
latter
 
user2953119
@Rapptz thanks! :) By the way, is it possible to find remote work on carrers at all? Do you know anyone which is working remotely?
 
nope
 
user2953119
Hmm... ok, thanks)
 
4:41 AM
If you use =default for the move constructor, then its noexcept-ness is determined by the noexcept-ness of the class' members' move-constructors. Right?
 
yes
you can be explicit about it if you want
and it'll tell you it's not possible if it isn't
 
-5
Q: Solution should be optimised

user2835891input file consist of person id n movies id: Amiya started an e-commerce company which sells original movie DVD's. Kudos to marketing team, who came up with the idea of selling each DVD's at Rs.1 and this campaign went viral bringing the server down within an hour of launching the campaign . T...

 
@StackedCrooked GCC caught me there with its non-noexcept std::string.
 
user3010322
I wonder what's the point at which a std::unordered_map's lookup becomes more effective that a lower_bound / upper_bound / binary_search on a vector...
 
O(1) vs O(log N)..?
 
user3010322
4:51 AM
Yeah.
 
user3010322
But there's a tradeoff at some point.
 
user3010322
Where doing std::vector<> searches are faster than std::unordered_map searches
 
O(1) eliminates any unneeded cache misses
 
user3010322
and then it's supposed to cross some kind of threshold.
 
Sure they are. The Stack Exchange sites are all a lie. They're just a cover for the CIA and the Illuminati to conduct tests on how long it will take for a group of nerds to start fighting each other to the death over little geeky trivia. They know everything about you. Your email address. Your IP address. How much time you spend on Stack Exchange. Etc. — Cupcake 21 hours ago
Oh this guy.
 
4:52 AM
However, linear search is fast too because the CPU will detect the linear pattern and prefetch.
 
 
However, cache writes will kick out other CPU caches.
I dunno.
 
user3010322
Hm.
 
@Feeds That tooltip text...
 
user2985029
why human though, why is the snake like a human and not like some other creature
 
5:02 AM
this is UB isn't it?
I'm wondering why -fsanitize=undefined isn't catching it
 
3 mins ago, by Rapptz
I'm wondering why -fsanitize=undefined isn't catching it
guess -fsanitize=undefined is pretty meh
I thought it'd catch it cause it seemed pretty obvious
 
user2985029
clang: error: unsupported argument 'undefined' to option 'fsanitize='
 
user3010322
5:32 AM
I wonder if std::remove_pointer works on member object pointers...
 
it makes T* -> T
 
user3010322
I guess that doesn't count for member object pointers.
 
user3010322
5:50 AM
What do you call this trait?
 
remove_member_function_pointer
 
@ThePhD You mean auto in there?
 
If you typedef'd T instead then I would have called it class_of
 
user3010322
Hm.
 
user3010322
remove_member_function_pointer makes some sense..
 
user3010322
5:54 AM
But it also removes the member variable pointer bits too...
 
those are still called member function pointers btw
 
user3010322
So maybe result_of ?
 
user3010322
@Rapptz std:: type traits call them member_object_pointer, e.g. std::is_member_object_pointer.
 
Right.
I forgot about that actually
 
user3010322
Oh well, removes both. std::remove_member_pointer
 
user3010322
5:55 AM
Ezpz.
 
std::mem_fn misconstrued my view on those
cause std::mem_fn(&a::b) would let you do call it as a function to get b
 

« first day (1376 days earlier)      last day (3577 days later) »