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

1:05 PM
btw
you do both know that that is the most worthless shit ever, right?
even more than a regular singleton
because get_instance is non-static but there are no constructors
so you could never even access any instance
 
Congrats on reinventing std::array badly
 
@DeadMG Of course it should be static :)
 
user142019
Oh lol I forgot to make it static.
 
@CatPlusPlus No no no, the nton will revolutionize the way we think about Design Patterns :)
 
user142019
DP means double penetration in my dictionary.
 
user784668
1:10 PM
@DeadMG Doesn't it make the nton better than the singleton?
 
Zeroton
 
user142019
class zeroton final {
public:
    zeroton() = delete;
}
 
char x[sizeof(zeroton)];
zeroton& z = (zeroton&) x;
 
user784668
@FredOverflow You forgot alignment.
 
1:12 PM
@Fanael It has no data members, so who cares?
 
user142019
lol
 
user784668
@FredOverflow The UB god.
 
user142019
@FredOverflow not initialized.
 
There is nothing to initialize.
 
No constructor. Valid code.
 
user142019
1:14 PM
Heh.
 
user142019
alignas(zeroton) char x[sizeof(zeroton)];
zeroton& z = (zeroton&) x;
z.~zeroton();
 
user142019
Is that possibru?
 
user784668
@Zoidberg You destroy something that doesn't exist.
 
user784668
typedef void Void; Void().~Void();
 
@Zoidberg Make that a SO question. You will get rich and famous, and chicks will stand in line to hump you.
 
user142019
1:16 PM
Yes chicks will really stand in line for me when I ask a question about destruction of objects whose classes are final but have no ctor.
 
The line of chicks will be zero length, and probably destroyed.
 
user142019
@MartinJames well, if the line of chicks is empty, all chicks will love me!
 
As long as they are properly aligned...
 
user142019
And all of them will hate me, too. And kill me, and fuck me.
 
@Zoidberg Will you give me half of your 0 chicks?
 
user142019
1:17 PM
They will all be alive and dead.
 
user142019
@FredOverflow what? No that's 100% of the collection!
 
You will be fucked if you post that stuff, yes.
 
user142019
heh :P
 
I would give him an upvote.
 
user142019
Don’t fuck me please. :L
 
1:25 PM
@Fanael using Void = void; noob
@Zoidberg Wait, I was offering you a choice?
 
@anandpatel Are you miss tine's little brother?
 
@Zoidberg Wait, if the nton can construct n Ts, how do you prevent other people from constructing Ts? :)
 
user784668
NTFS u commiting journal after every metadata op or what
 
First good case I've seen for justifying rape.
 
@MartinJames wat
 
1:42 PM
The Zoid was emitting strange code and the puppy wants to fuck him for it. Sounds reasonable... :)
 
1
A: Understanding copy-initialization in C++, compared to explicit initialization

user1056575In your first example, as you note, the behavior is undefined even though the syntax is okay. A compiler is therefore permitted to refuse the code (the undefined behavior must be guaranteed however; it is here, but it wouldn't be if the invalid initializations were never actually executed). You...

EDG fame on SO ^
 
@Zoidberg Reminds me of my MultiTON.
 
8
A: Looking for a better C++ class factory

Johannes Schaub - litbYes, there is a way. A pretty simple even in C++ to what that C# code does (without checking for inheritance though): template<typename T> BrokeredObject * GetOrCreateObject() { return new T(); } This will work and do the same as the C# code. It is also type-safe: If the type you pass ...

@StackedCrooked ^^ mingletons!
 
user784668
I prefer KISStons: T t;
 
@JohannesSchaub-litb Wow, that's an old answer :D
@Fanael How simple!
 
user784668
2:03 PM
@StackedCrooked The sad thing is that most compilers don't support KISStons yet.
 
How stupid.
 
user142019
@FredOverflow friendship.
 
user142019
2:21 PM
If spider silk is stronger than steel, why isn’t is used in building bridges?
 
@Zoidberg They're starting to
 
Is struct Derived : Base always public inheritance, or does it depend on whether Base is a class or a struct? I can never remember this :(
 
They recently made goats that could make spiders silk, actually
SPIDERGOAT... SPIDERGOAT... mostly just... sits around maaaa'ing
 
user142019
@FredOverflow Yes.
 
Hoy
 
user142019
2:26 PM
struct D : B is public inheritance, class D : B is private inheritance.
 
Okay, so I can see from that one line, don't have to consider how B is implemented.
I think it would be easier to create the static array n_instances in the function get_instance() rather than to declare it as a static member. By the way you can find example of this pattern on wikipedia with the entry "multiton design pattern". — Etienne Cordonnier 45 secs ago
Wow, that's really smart.
 
Why why why why why
Why
 
> Ensure a class has only n instances, and provide a global point of access to them.
But mainly for the lulz.
 
user142019
Hey. How is in-function static implemented?
 
user142019
Using a flag and a branch?
 
2:33 PM
Yes, unless the initialization is trivial.
 
user142019
Is it thread-safe?
 
Good question!
 
user142019
And a dupe without a doubt.
 
25
Q: Is local static variable initialization thread-safe in C++11?

Ralph ZhangI know this is an often asked question, but as there are so many variants, I'd like to re-state it, and hopefully have an answer reflecting the current state. Something like Logger& g_logger() { static Logger lg; return lg; } Is the constructor of variable lg guaranteed to run only...

Too bad it already has 25 votes, otherwise I would have upvoted.
 
user142019
@FredOverflow That’s fucking awesome.
 
user142019
2:35 PM
@FredOverflow Upvote to 42!
 
@Zoidberg Or you could downvote it to 24, then I upvote to 25, and then you retract your downvote.
 
user142019
Then it’s still at 26 in the end.
 
Yes, but then he will get a "nice question" or whatever it's called notification for the second time!
 
user142019
Really?
 
not 100% sure, but I think so
 
user142019
2:37 PM
That’d be stupid.
 
Can somebody upvote this one to 25 again? I want to check if I get another "great question" notification.
No wait, "good question", is it?
lol, now it's at 23 :)
 
user142019
My downvote is locked. xD
 
user142019
You have to edit the post before I can remove it.
 
Don't! The point is somebody else has to bring me to 25. Else I don't achieve orgasm, erm, "good question".
 
user142019
T_T
 
2:45 PM
i downvoted it
 
user142019
ITT: Fred has very weird fetishes.
 
then i upvoted it just to give you 7 instead of only 5 reps
 
Oh, it's at 26 now. Hm, no notification thus far... it seems I was wrong :(
Well, I guess I can upvote the local static question then without worries :)
 
or you just suck
:P
 
user142019
It takes a few billion years before the notifications appear.
 
2:49 PM
I once upvoted from 9 to 10 and retracted my upvote repeatedly, thinking "maybe this will flood his inbox" lol
 
user142019
lol
 
user142019
Stack Exchange isn’t written by morons. Oh wait…
 
it really kinda is :P
 
Actionscript is super easy, right?
 
user142019
JEFF AND JOEL WHAT HAVE YOU DONE.
 
2:52 PM
OMG I need this.
 
lol
 
user142019
@Crowz Haskell is simpler.
 
lulz
@FredOverflow hmm warm chocolate
 
can MinGW cross-compile to Linux or Mac?
 
user142019
Looks like a toilet full of diarrhoea.
 
user142019
2:53 PM
I want OS X with a Linux kernel.
 
@Zoidberg Haskell scurry.
 
@Zoidberg Nah, it looks a lot more like blood.
 
user142019
And xmonad.
 
user142019
And pacman.
 
@FredOverflow it works when you repeatedly comment on one of his posts and then delete the comment
then for each comment he will get a notification
last i checed they were not removed :)
 
2:55 PM
hmmm
the Wide parser currently accepts Main ... stmt; .
 
what does that even mean
 
nothing
 
@FredOverflow lmao
 
I just consumed the tokens without checking them for the initial parser :P
 
2:56 PM
@JohannesSchaub-litb DeadMG++
@JohannesSchaub-litb I just tried, did it work?
 
user142019
Wow, I just Googled "lazy bytestirng to strnig sbytrsintr" instead of "lazy bytestring to strict bytestring".
 
> boost::stirng. When std::string just isn't strnig enough!
 
@FredOverflow does it work?
I just downvoted
-1
A: Main's Signature in C++

KedarISO/IEC 9899:TC3 Section 5.1.2.2.1 Program startup The function called at program startup is named main. The implementation declares no prototype for this function. It shall be defined with a return type of int and with no parameters: int main(void) { /* ... */ } or with two parameters (refe...

 
@JohannesSchaub-litb I only received one. How many did you receive?
 
@FredOverflow hm :/
@FredOverflow i did send two
@FredOverflow zero
 
3:00 PM
lol, I sent three :)
 
undefined behavior on the server?
 
It seems our dreams of flooding with comments are over.
I received the one while it was not deleted yet. Something about int lists.
 
oh
also I observed that some comments just made (some minutes ago) sometimes are displayed as "4 hours ago" or something
I observed that std::vector(input_iterator, input_iterator) is not declared explicit
 
why would it be? it's a multi-argument constructor.
 
and I am now trying to find code that compiles when calling that ctor with an initializer list
@DeadMG to prevent unwanted conversions
so what I look for is an initializer list that does not pick the initializer list ctor of vector, but that other ctor and that still results in a valid program
if such a scenario exists, I think the standard lib should be fixed to make that ctor explicit
if it does not exist, me might be able to ignore this design problem
@JonathanWakely I have intentionally written this quiz question: stackoverflow.com/questions/3309042/… :) — Johannes Schaub - litb 1 hour ago
trolling the libstdc++ maintainer :)
that's only possible on SO
if you say vector<wstring> v = { "hello", "folks" } it picks that ctor with the input iterators, but it does not compile
for example
this artificial construct picks the ctor and compiles, but does not happen in real code as far as I know:
struct A { A(char); }; vector<A> v = { "hello", "folks" };
making the ctor explicit would prevent such crap
note that at runtime, this code is very likely to crash
as a more realistic example: vector<char> v = { "A", "B" };
ah yeah that's it! xD
 
3:14 PM
The short takeaway: in C++03, explicit only made sense for single-argument constructors, but in C++11, it can make sense even when there are more arguments (even though you're not particularly likely to encounter that need on a regular basis).
 
@JohannesSchaub-litb No, it isn't.
vector<T> is supposed to be able to compile from T*, T*.
there's nothing more or less invalid about vector<char> v = { "A", "B" } than vector<char> v("A", "B");
 
0
A: Industrial-strength n-ton base class template

FredOverflowAs Etienne Cordonnier suggested, it is much easier to use a local static instead of a class static: template<typename Derived, size_t n = 1> class n_ton_base // Singletons are the default { protected: // prevent n_ton_base to be used outside of hierarchies n_ton_base() {} ...

 
@DeadMG huh
@DeadMG pointers are random access iterators and vector has a ctor that can take them, begin and end
 
yes, I know that.
but explicitness would not fix the error your sample code has.
 
@DeadMG using the = notion has been designed to mean "value initialization"
whereas "the { .. }" notion was designed to be "ctor call initialization"
 
3:28 PM
I know full well what the syntax means, y'know
 
conceptually, the first forbidding and the second allowing explicit ctors
@DeadMG it will give a compiler error
so that would be good
instead of letting it silently compile
 
no, it wouldn't.
 
once they "fix" it
by explicitly constructing
they still have the run-time error.
 
3:29 PM
you've just introduced a random arbitrary compiler error that has absolutely nothing whatsoever to do with the actual problem.
 
but that's not a good argument
 
there's nothing invalid about char s[] = "hello"; vector<char> v = { std::begin(s), std::end(s) };
 
"here we have a random value that should not be implicitly convertible to my class. but because it would still be a runtime error if i explicitly initialize the object, making the corresponding ctor explicit would not be good"
@DeadMG I believe that that code is flawed
 
it would not solve the actual error, and there are plenty of perfectly good codes using it.
 
because it treats { begin, end } as a "vector of char value"
but it is merely a "pair of iterators"
 
3:31 PM
the problem isn't that a pair of iterators is convertible to a vector
 
that can be used to construct the latter
 
the problem is that you gave it fucked-up iterators.
explicitness or not will not fuck-up or un-fuck-up the iterators.
 
construct is the purpose of "explicit" constructors. taking a value of its class is the purpose of non-explicit constructors
@DeadMG no
even if i give it correct iterators, making it compile is not going to be good
 
it's fine
 
the default should be "make it explicit if it is not obvious". A pair of iterators is the value of pair<Iterator, Iterator>. but not the value of Iterator::value_type []
a pair of iterators is to a list of its value type the same way that a construction plan is to a house.
you can't give a construction plan where a house is expected.
 
3:34 PM
you can if the builders implicitly build it for you.
 
in our case, the "explicit" ctor is the builder
 
you have shown no reason why it should be explicit.
show me any codes that have unexpected runtime or compiletime behaviour with the implicit conversion
and that would be fixed if explicit was used instead
 
for the same reason that (int count, T value) is explicit
 
so basically, you don't have any examples.
 
i already explained
6 mins ago, by Johannes Schaub - litb
construct is the purpose of "explicit" constructors. taking a value of its class is the purpose of non-explicit constructors
 
3:38 PM
blah blah blah
 
so basically you don't want to know
fine
 
you don't justify that position, and nor do you show how violating this is problematic.
 
why do you ask anyway
 
all you've done is waffle about it meaninglessly.
show codes, or gtfo
 
a function overload should be safe in isolation
not depending on what other overloads exist
 
3:39 PM
also, count, value is not explicit in C++11, according to cppreference anyway.
it was only explicit in C++03 because value was = T().
 
if other overloads exist that do take a value of two iterators, the presence of the vector overload gives you an ambiguity
 
no, they don't, since the compiler will prefer not to explicitly convert if possible.
 
of course that is not fixed by making the ctor explicit, but I blame a broken rule system for that. doesn't reduce the validity of my argument
@DeadMG not true
 
plus, the compiler will not go from f(it, it) to f({it, it}) for funsies.
an implicit conversion cannot change the number of arguments
 
void f(vector<string>); void f(vector<wstring>); int main() { f({"hello", "folks"}); } is ambiguous
and it would still be if the iterator-taking ctor of vector<wstring> was explicit
 
3:41 PM
@JohannesSchaub-litb It completely does, since your argument is that it should be explicit, so there should be some benefit to explicitness. If explicit doesn't solve the proposed problem, then that's no reason to make it explicit.
"Let's make it explicit because making it explicit doesn't solve any problem."
 
@DeadMG the benefit cannot be argued away just because there is a broken rule that prevents the benefit to apply currently
 
yes, it absolutely can.
 
And here I thought I was bored out of my mind
 
if there is no applicable benefit to explicit, then there's no reason to make it explicit.
you can't argue that it might be beneficial if the rules were different, because that's utterly irrelevant.
 
@DeadMG the benefit is that void f(vector<char>); int main() { f({begin, end}); } becomes illformed
 
3:44 PM
why would I want that to be ill-formed.
 
i prefer function arguments to be only accepted by function parameters if the argument conveys a value of the type of the respective parameter
whether the argument is of the type of the parameter is irrelevant. but the argument must be of a value of the type of the respective parameter.
 
why?
 
if it is merely a parameter of a construction algorithm, it should not be accepted. it should be passed to a constructor of the type of the parameter and the result then should be passed
because that's how explicit works and how it all makes sense
 
you've said that before, but you haven't shown it, nor given any evidence
 
If you want your type system to even begin making sense, eliminate all implicit conversions
 
3:46 PM
@DeadMG i have plenty of evidence
 
then show it
 
you can do a code search for "explicit"
 
1 result: explicit operator bool
 
besides
even if I accepted your argument to be true... then it still doesn't justify explicit, because both a vector and a pair of iterators are a range.
 
3:48 PM
I just sent a mail to the library issues list maintainer
but a range is not a vector
 
and when the Bristol meeting comes, I'll tell him how bad an idea it is
 
you can take every nth. element of the range and then your result is a different vector.
 
user142019
I love <$>.
 
user784668
@Zoidberg It's just fmap.
 
both a boy and a girl are humans. but a girl is not a boy (unfortunately)
 
user142019
3:52 PM
@Fanael I know, but it looks nicer IMO.
 
user142019
Things like (length, _) <- runGet getWord16be <$> BS.hGet h 2.
 
Fucking UPlay
Not only does it 500 on login
 
@CatPlusPlus Let me guess: U don't actually get to Play.
 
It also limits the password to 16 characters but neglects to use maxlength on fucking password fields
Go die in fire idiots stop making webapps forever
 
user142019
Hmm.
 
3:58 PM
I wanted to play From Dust, I pressed Play in Steam and Uplay goes up and HOW DO I START THIS FUCKING GAME OH MY GOD
 
Hi @CatPlusPlus
 
user142019
How could I eliminate the if expression? gist.github.com/4d8ad1f0b63ec9957043 I thought of using the Maybe monad but I'm already in the IO monad.
 
@CatPlusPlus From Dust wasn't a very good game anyway.
 
user142019
I want early return. :<
 
user142019
4:06 PM
Haha lol.
 
@DeadMG That game reminded me of a game my friend used to play: Populous.
 
@Borgleader I hope that Populous didn't suck as badly as From Dust.
 
Populous was fucking awesome
@Zoidberg MaybeT IO
 
user142019
Oh of course. T_T
 
user142019
Thanks.
 
4:10 PM
PlayStationPlayStation Network |genre = God game, Real-time strategy |modes = Single-player, Multiplayer |ratings = ESRB: Teen (T) |media = |requirements =Pentium 133 MHz, 16 MB RAM, Windows 95, DirectX, CD-ROM drive, and 100 MB hard drive |input = }} Populous: The Beginning is a strategy and god-style video game. It is the third entry in the Populous video game series, developed by Bullfrog Productions in 1998. The PC version of the game was released November 30, 1998 and a PlayStation version was later developed and released on April 2, 1999. Unlike earlier games in the series, which cast...
Fun as hell
 
@DeadMG A long time ago, you said My Property Class was failing to use rvalue and lvalue. Care to share why? I'm about to polish and touchup the class and I want to make sure I'm all okay and good to go.
 
 Property ( T&& value ) {
     operator=( value );
 }
a named rvalue reference is an lvalue.
 
..... Uh.
 
Yup std::forward it
 
Oh, okay.
 
4:13 PM
there are a few other instances of this offence
 
Well, I think I cleaned up the only one that matters: inside property.
The myset and myget from that example I won't be using...
 
show new
 
@DeadMG What is this, a constructor delegating to the assignment operator? Seems rather un-idiomatic...
 
agreed
usually the other way around
 
i like to phrase the rule as "a short-lived, expiring or temporary rvalue reference is an rvalue"
 
4:17 PM
You know what's awesome? This is
 
And I hope that open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1585 will make my phrasing more correct than the "a named rvalue reference" phrasing
 
@DeadMG Uh. Okay /cc @FredOverflow
 
right
now I'm left thinking, "Why the fuck would I want a Property<T> instead of a T?"
 
For the nice syntax, of course!
 
what nice syntax?
 
4:25 PM
Here's a trick: template<class ...Args> bool AreEqual(Args ...args) { return ArgsEqualCVarArgs(sizeof...(args), args...); }Johannes Schaub - litb 15 secs ago
 
@DeadMG Property<Vector3, default_get, RecomputeFoVSet> FieldOfVision; /* ... Much later */ Camera.FieldOfVision = Vector3(60, 45, 60);
 
@DeadMG like in C# I guess?
 
@Zoidberg Watchya writing this time anyway
 
user142019
@CatPlusPlus Minecraft server.
 
user142019
I needed to read and parse kick packets.
 
4:29 PM
The other thing I need to write is a direct_property, one that can bypass the getter entirely and not return a copy.
 
What's the usecase for having different setter for lvalues and rvalues
 
Just incase you're setting something you'd want move'd instead of copied.
I wouldn't imagine anyone would do it, but there's always someone who'd like to stick a std::vector<double> on a property...
 
Yeah no I mean why two different types, you can already distinguish between them via different operator() overloads
 
Oh, it's just for Lambda compatability.
 
user142019
@ThePhD just take by value?
 
user142019
4:34 PM
rvalue will be moved, lvalue will be copied.
 
@Zoidberg So then one by-value, another by-reference?
 
@ThePhD So now you can't auto x = Camera.FieldOfVision, for example?
 
user142019
@ThePhD why do you need byref anyway?
 
@DeadMG The price of the using a property, I guess?
 
@ThePhD It's a lot higher than just recomputing the FOV every frame and leaving it as a regular variable.
 
user142019
4:35 PM
auto x = Camera.FieldOfVision.get() lol
 
Why is your FOV a vector anyway
 
@DeadMG I usually only recompute if I truly, truly have to.
 
Black magic
Anyway I'm too bored to do anything
This is critical situation
 
@ThePhD You mean like how your caller will probably only have a few cameras and the cost of recomputing their fov is nothing?
 
@CatPlusPlus It was an example, but sometimes you can use FoV's z and x to do crazy warping and shit.
 
4:37 PM
wait, wait
what the fuck is fov z anyway?
 
user142019
@CatPlusPlus unbore yourself. Oh wait.
 
Uh. I dunno. Warping values for top and right?
It's not like I actually have Vector3 FoV.
It was just a quick example. ._.
 
I can see Vector2 if you want to specify FoV for two axes for some reason but where the hell does the third come in
 
@CatPlusPlus Depth warping!
 
Where's that angle at seriously
 
4:39 PM
Like Mass Effect warp driving, but on steroids. For your eyes.
 
4:53 PM
> A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the following constraints: The first token in the sequence is a # preprocessing token that (at the start of translation phase 4) is either the first character in the source file (optionally after white space containing no new-line characters) or that follows white space containing at least one new-line character
> The last token in the sequence is the first new-line character that follows the first token in the sequence.
is it just me or does the last sentence not make sense!?
or wow it is just me!
 
Okay, I ordered "Head First Design Patterns", "The Passionate Programmer" and "The Google Resume". Anybody got those books?
 
it follows the first token... not the last because there must be no other newlines..
 
@FredOverflow what's the google resume about?
 
Sounds really boring
 
4:59 PM
@FredOverflow "Don't be a terrible programmer, and don't spend all day procrastinating in the Lounge".
 

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