« first day (465 days earlier)      last day (4483 days later) » 

7:00 PM
hey
does c++ have some "standard" unit testing framework that everybody uses?
(and if not, do you have any recommendations?)
 
no
boost.test or gtest (google test)
 
sbi
@DeadMG Actually, my day already was miserable before you arrived.
 
this is not the first time we have met today :P
 
sbi
Mooing Duck, Washington, United States
8.1k 5 20
Washington, United States — the only place where ducks moo.
3
 
wow, I can't believe that he actually is a Merkin
I was just throwing that out
 
7:03 PM
"place"
 
sbi
@StackedCrooked You need Brain Bleachâ„¢ Guaranteed to wipe off bad memories.
@RMartinhoFernandes Indeed. Sigh.
@DeadMG You mean that would explain why my day was miserable earlier already?
 
nah
not unless I give off some kind of misery aura that permeates through the Intertubes
 
sbi
@DeadMG You know, actually we did not want to tell you, but now that you got so close to finding this out for yourself...
 
wow
now give me some moneys and I'll go bother some guy you don't like
 
7:09 PM
lol, already monetizing his new found power.
 
sbi
@DeadMG Why would I spend money on something I can do myself just fine? :)
 
I need to eat, you know
 
sbi
Hovering around freezing point in Munich. I travel a lot, but nowhere near enough to places with a warmer climate than home...
So, I'm announcing a new deal: I'm prepared to offer a rate reduction for new clients in warmer climates. Yes, I'm serious.
LOL!
 
does GCC have __is_complete_type?
 
I think you can hack that with sizeof and SFINAE.
 
sbi
7:12 PM
Curious about your progress on the harder #stackoverflow / #stackexchange badges? Check out: http://bit.ly/xasoX1 (built on API V2.0)
 
I wonder why java programmers don't need __is_complete_type
 
sbi
^ For the badge hunters among you!
@Abyx They wouldn't be able to grasp the concept?
(Oh, I'm in a nasty mood tonight...)
 
is it really useful concept for programming?
it looks so esoteric
 
sbi
@Abyx If all you have is header files instead of a module concept, incomplete types are your only chance to design two concrete classes that depend on each other.
 
no, I can use complete abstract base classes for it, and I don't need concrete classes depending on other concrete classes
 
sbi
7:16 PM
@Abyx :b
 
Not two complete abstract base classes that depend on each other.
 
Xeo
@RMartinhoFernandes ideone.com/t3RRc
 
sbi
Any other musicians out there notice that ever since they shut down MegaUpload, the money has just been POURING in?
 
Xeo
The only reason it doesn't work in C++03 mode is that C++03 doesn't sfinae on invalid expressions inside of sizeof :(
 
sbi
I lurve that tweet.
 
7:18 PM
...
 
what's the difference between preconditions and conditions in the type_traits of the standard? With is_constructible, all "conditions" says is: see below, but I cant seem to find the "below".
 
Xeo
> Top tags above 15 votes: c# (77) java (67) c++ (2387) c (113) arrays (75)
Wuah, why ?! WHY?!
 
sbi
@Xeo What is this?
 
@rubenvb Usually, preconditions are to be asserted at runtime.
 
Xeo
@sbi From the badge hunter page, for Generalist
 
sbi
7:21 PM
@Xeo What is "the badge hunter page"?
 
Xeo
9 mins ago, by sbi
Curious about your progress on the harder #stackoverflow / #stackexchange badges? Check out: http://bit.ly/xasoX1 (built on API V2.0)
 
sbi
@Xeo Ah, it's from that app?
 
Xeo
Aye
 
@RMartinhoFernandes so I'm guessing __is_complete_type is a runtime thing? Cause it's mentioned in "preconditions"
 
Wait, what are you talking about? I'm sleepy, so I might be spewing nonsense.
 
Xeo
7:23 PM
@rubenvb huh?
There are no types at runtime in C++
 
type_trait:
template <class T> struct is_standard_layout;
Condition:
T is a standard-layout type (3.9)
Preconditions:
T shall be a complete type, (possibly cv-qualified) void, or an array of unknown bound.
 
If those preconditions are not met, you have UB.
So you don't need to test for them.
 
Xeo
multi-line markdown 25 : 0 users who can't remember the newbie hints
 
@Xeo no markdown, just forgot shift when enter'ing
 
Xeo
Oh, damn. So we're still at 24
 
7:25 PM
@RMartinhoFernandes I'm trying to do better than std::, so I might as well static_assert them :)
 
@rubenvb That's valid UB, so no better. Kidding!
 
Xeo
Really, that trait was way too easy
 
You do know that the compiler will likely blow up already, right?
 
@Xeo well, it's not a trait, really. As far as C++11 is concerned :)
 
Woo, I have 10 answers with exactly 9 upvotes.
 
sbi
7:31 PM
@thecoshman, @jalf: In light of today's discussion about "piracy", you might want to read this interesting article by someone who is, allegedly, hurt by piracy. TL;DR: "Make good stuff, then make it easy for people to buy it. There’s your anti-piracy plan."
> I believe in copyright. I benefit from it. I don’t want it to go away. I love that we have laws and people to enforce them. But if I had to give up one thing, if I had to choose between copyright and the wild west, semi-lawless, innovation-fest that is the internet? I’ll take the internet every time.
 
Evil standardese!!
Given the following function prototype:
template <class T> typename add_rvalue_reference<T>::type create();
the predicate condition for a template specialization is_constructible<T, Args...> shall be satisfied if and only if the following variable definition would be well-formed for some invented variable t:
T t(create<Args>()...);
[Note: These tokens are never interpreted as a function declaration. —end note ] Access checking is performed as if in a context unrelated to T and any of the Args. Only the validity of the immediate context of the variable initialization is co
 
Should we increase the counter to 26?
 
@RMartinhoFernandes NO!
 
Xeo
@rubenvb what's evil about that?
becaus they didn't use declval instead of create?
 
heck, I don't even get declval() (yet).
I need a compiler intrinsic called __is_wellformed
sheesh
 
7:37 PM
decltype(expression) test(int) is your wellformedness tester.
I'm having a déjà vu moment.
 
Xeo
@rubenvb SFINAE, it's intrinsic to the compiler
 
-1
Q: terminating template function recursion

user602592I am trying create print method for tuple. I checked out solutions specified by others, all using a helper struct. I don't want to use helper struct. I feel following code is valid but not able get it stright. #include <iostream> #include <tr1/tuple> template<typename tupletype,s...

"I've seen working code, but don't want working code, so I've created not working code and it doesn't work. Help?"
 
Xeo
gcc 4.5.1 doesn't have decltype yet, right?
 
sbi
@CatPlusPlus I was faster than you! :b
 
Yes it does.
 
7:41 PM
It does.
@sbi Yeah, I was thinking about writing out the working code.
 
std::cout<<std::tr1::get<0><<" ";
WTF.
 
That's a fish!
 
sbi
@CatPlusPlus I haven't checked my code, so it will likely contain errors.
 
Xeo
@LucDanton lol'd
 
It's a fishy code.
 
7:45 PM
..
 
Xeo
Anyways, is_constructible is also so easy...
 
@Xeo No, it's full of corner cases.
 
Xeo
oh?
 
@sbi Not anymore!
 
sbi
@RMartinhoFernandes Thanks!
 
Xeo
7:54 PM
template<class Tuple, unsigned I>
void print(Tuple const& t, int2type<I>);

template<class Tuple>
void print(Tuple const& t, int2type<0>);
There, "partial specialization"!
 
@Xeo then why does libc++ need 20 helper structs??
 
Xeo
@rubenvb uhm.. dunno :)
 
@RMartinhoFernandes maybe I'm missing an #if, but partial specializations count as struct for me
 
Xeo
You need a partial spec on void, though, otherwise is_constructible<void>::value will be 'true'
 
8:00 PM
@rubenvb Well, I call partial specializations "partial specializations" :P
I know it sounds boring but...
 
how can I thread safely initialize a local static variable?
 
from my understanding local static variable initialization is not thread-safe in VS2010, yet.
 
sbi
@Xeo Upvoted.
> As a note, you can partially specialize function templates in C++11 — Is that true??
 
Xeo
@sbi No
 
sbi
8:07 PM
@Xeo Thanks. For a moment I thought I had missed something really major there.
 
Xeo
> 26.666 rep
hihi, 666
 
evening
what would be the easiest way to keep track of where in a switch() case statement a piece of code is? I've got one running in a timer, every 10ms, but I need to keep track where in the switch it is, so I can know when to print certain messages on the GUI, and when not to.
 
Xeo
@TonyTheLion Sounds like a state machine
 
well the switch in question is a state machine, but I need to track where I'm at in the state machine
 
Xeo
0
Q: Singleton's instance and scoped_ptr

OckonalI have a singleton with a following structure: // Hpp class Root : public boost::noncopyable { public: ~Root(); static Root &Get(); void Initialize(); void Deinitialize(); private: Root(); // Private for singleton purposes static bo...

/sigh
@TonyTheLion You usually do that by saving the value you switch over
 
8:22 PM
I left a comment
 
@TonyTheLion So, you need to make the current state available elsewhere?
 
@RMartinhoFernandes no, I just need to print certain message to the output, however I should print them only once when it's at a certain state. As long as it's in that state, I don't want to print again, however, when it moves to the next, I should print any messages in that state, once, move on. When we get to top (first case) again, we need to go through and print the messages again, only once per state. Since this is inside a timer, a state could be held over multiple invokes of the timer event
 
Xeo
@TonyTheLion Well, save the last state
 
Xeo
If it's different from the new one, print
 
8:26 PM
An edge trigger.
 
morning
 
@DeadMG you said that hours ago
 
Xeo
Argh
The current revision of Clang even has initializer lists, but I can't use them :(
 
I dislike how intellisense shows errors in MSVC. It's not nearly accurate enough for that. Intellisense says I have 69 errors in my code. The compiler says 0.
 
Xeo
Intellisense is based on the EDG frontend IIRC, not whatever actual parser MSVC uses
@sbi, you may want to remove the "only" from your answer on the tuple thing
 
8:35 PM
@Xeo comments in template clsses seem to blow it's tiny mind
@Xeo The "errors" change depending on where I put my comments :/
 
sbi
@MooingDuck class templates
 
Xeo
lol
 
@sbi picky picky.
 
Xeo
Maybe the intellisense db is borked
Close the solution and delete the .sdf
 
IntelliSense is really crappy.
 
sbi
8:37 PM
@Xeo I'm not sure. I was obviously wrong, I admitted to this in my comment to your answer, which will very likely be accepted later, and I have no problem for the rest of world to see that I was wrong.
 
Xeo
They should build a nice one with libclang...
 
sbi
Yes, @DuckingMoo.
 
meh, I don't actually mind programming without it, although at times intellisense is very very handy
 
Xeo
@sbi You can just edit it in as a "reflection" on that you were wrong. :)
 
sbi
@Xeo Go ahead and do it, if you consider it important.
 
8:38 PM
@sbi damn, someone was wrong on the internet
 
I'd rather have a totally dumb tool than a half-smart one.
 
sbi
@TonyTheLion I am not "someone"!
 
Of course you are.
 
Xeo
Damn you, Clang, Y U NO DEFINE __has_feature(cxx_initializer_list) TO BE TRUE?! :(
 
sbi
@RMartinhoFernandes Yeah, nothing is as bad as half intelligence.
 
8:39 PM
@sbi to me you're someone, just like everyone else is someone :P
 
Hey why is it that when you check the size of a single character variable it's 1 byte but each character in an array of characters is 4 bytes?
 
You're doing something wrong.
 
sbi
@oorosco It isn't so.
 
http://codepad.org/y4NDi3k1
http://codepad.org/6J9CTiKY
little snippets
 
@oorosco That's an array of pointers.
 
8:43 PM
oh okay
so it basically assumes that yyou can store somethign other than a char
thus it allocates 4 bytes in case it's a double etc
??
 
No.
char* x[10] is an array of pointers to characters. It can't store anything else, only pointers to characters.
char x[10] is an array of characters.
 
@Xeo huh, what?
 
Why is the pointer address only 4 bytes though? Is it because it's on a 32 bit machine?
ooops
no that doesn't make sense either
Why though???
 
@oorosco Yes, that's it.
 
Okay cool
 
8:49 PM
hey all, does anyone know how to create the following pattern with nested loops: 0,0,1,1,2,2,3,3
 
makes a bit of sense
 
@JohnMerlino Why nested loops?
 
I dont know how else to create such a pattern
 
for(int i = 0; i < 4; ++i) { yield(i); yield(i); }
 
problem is im iterating through objects so I need the value of i to represent the object in an array
 
Xeo
8:51 PM
@rubenvb The head revision has initializer_list support, but (as with constexpr), libc++ defines _LIBCPP_NO_GENERALIZED_INITIALIZERS, and <initializer_list> is empty :<
 
@JohnMerlino My approach above doesn't lose the value of i. Unless you mean something else.
 
Xeo
#include <initializer_list>

int main(){
  for(auto i : {1, 2, 3}){
  }
}
t.cpp:4:16: error: cannot deduce type of initializer list because
      std::initializer_list was not found; include <initializer_list>
  for(auto i : {1, 2, 3}){
               ^
t.cpp:4:16: error: cannot use type 'void' as a range
2 errors generated.
 
WinRAR
 
Xeo
I think I'll just hack that libc++ <__config> header..
 
8:54 PM
@Xeo unusual
 
Xeo
It's just the normal bleeding with bleeding edge. :|
 
for(int i = 0; i < 8; ++i) { yield(i / 2); }
@JohnMerlino this also works.
 
Xeo
Ooooh... Clang finally gives a coherent error message:
t.cpp:2:12: error: lambda expressions are not supported yet
  auto l = []{};
 
whew
nearly spewed the password for my password database into the chat
 
Xeo
8:55 PM
So, syntactically, they're already recognized at least
 
@DeadMG Typing with focus on the wrong window?
 
yes
 
Xeo
hocus focus
 
and then World of Warcraft is offline anyways
 
Xeo
It is?
 
8:56 PM
"Due to technical issues, the login servers are currently offline."
bitchnizzles
 
Xeo
I'm starting to believe that someone spread the rumor that people on SO are actually all psychics.
 
well, I am
I just don't want to know what's going on in his mind
 
Guess what I'm thinking.
 
thanks for responses
 
@RMartinhoFernandes Haskell
 
9:03 PM
Actually it was "The puppy will never guess what I'm thinking."
 
prove it#
I knew exactly what you were thinking and you just lied to try and show me up
your good old friend, DeadMG
never been anything but loyal to you
and now you stab me in the back
 
well, with my dying breath, good sir, I spit in your general direction
also I pull out my gun and shoot you
I mean, why not?
 
Xeo
@RMartinhoFernandes You're a robot, you don't think, you only interpret.
 
Ow.
That's a low blow.
 
sbi
9:11 PM
@RMartinhoFernandes It would be, if you weren't a robot, and could feel. :b
Oh. Now I seem to have hurt the robot's feelings. :-o
 
Xeo
BAM BAM BAM! Keep showing the robots their place, so they don't even think of starting a revolution
@sbi I thought he has none?
 
he likes to emulate having them
 
sbi
@Xeo Rolls eyes. I was being sarcastic.
 
Xeo
@sbi I was being explicit. :>
 
sbi
(Came from here.)
 
9:22 PM
Hi guys
 
lol
Getters FTW.
 
meh
my state comparison in the state machine doesn't work
because the timer is too fast, and the states aren't always being taken in order
I guess I'm gonna have to use a counter or something a bit more intricate to make this work properly
hmmm, perhaps I can have an object that knows everything printed to the GUI, and so when printing something, I can see if it was already printed, when, etc
 
@sbi Ha, Canada Post.
 
@JohannesSchaublitb Wasn't there a GotW about that a little while ago?
Ah, found it: gotw.ca/gotw/076.htm
 
Xeo
44
Q: more spirit madness - parser-types (rules vs int_parser<>) and meta-programming techniques

Hassan SyedThe question is in bold at the bottom, the problem is also summarized by the distillation code fragment towards the end. I am trying to unify my type system (the type system does to and from from type to string) into a single component(as defined by Lakos). I am using boost::array, boost::varian...

> He asked for C++, not Perl. – Craig Stuntz 2 mins ago
 
Xeo
Woops, I wanted to link to an answer :<
 
Xeo
9:46 PM
Too late I guess, it's been deleted
 
We can see it.
 
The user seems to have been deleted as well.
It wasn't an anonymous user before the "answer"'s deletion.
 
@sbi grats!
 
@sbi, welcome in the popular questioners gang
 
whoa, I was debugging a project in MSVC10, and while the code was at a breakpoint, I added 3.4567890108*2.1098765411 in a comment (to help me work through the math) selected it, and the tooltip read 7.29339804. I wonder how it determines what to show in the tooltip and if that's a security risk.
 
A comment?
 
@RMartinhoFernandes yeah, I added that text to a comment, selected it, and MSVC evaluated it
 
@sbi I've got some too
 
I'm working through fixed point math. I wrote two completely different implementations, both are wrong :/
 
10:08 PM
meh
@MooingDuck you mean, you're using fixed point arithmetic?
 
@TonyTheLion well, trying. Multiplication/Division are hard. Multiplication is close, division is dead-wrong
 
Xeo
@sbi I swear the latest is thanks to me linking to it on gotw #103 :P
 
jeez I didn't realize I've asked a question that has more than 18k views now
 
Which one? The one from the interview?
 
10:15 PM
@JohannesSchaublitb scary come closer to the tracks
 
lol
@user800454 it's advertisement for a bone yard agency
 
> I'm aware that MD5Block is technically "unsafe" since it doesn't take a parameter which describes the length of the memory block pointed to by p, and yet, I'm fine with this
0
Q: Why does this implementation of MD5 not work?

Robert Allan Hennigan LeahyThe code: void Hash::MD5Block (const void * p, MD5Result * state) { unsigned int a=state->Low; unsigned int b=state->LowMid; unsigned int c=state->HighMid; unsigned int d=state->High; for (int i=0;i<TOTAL_OPS;++i) { unsigned int f; unsigned i...

 
@JohannesSchaublitb I've also seen it advertising churches. Photoshop ftw
 
@TonyTheLion Oh, not that guy again.
 
10:24 PM
oh you have experience with this guy?
 
^ Seen at Google Montreal's offices.
 
@TonyTheLion Just yesterday, I had to read him his own question.
 
amazing! Just got this runtime error:

../../../../../extra/yassl/taocrypt/src/misc.cpp:103: int __cxa_pure_virtual(): Assertion `!"Aborted: pure virtual method called."' failed.
 
@RMartinhoFernandes the one on placement new?
 
10:26 PM
@TonyTheLion Please debug my flawed code and find the problem that keeps its flawed ideas from producing correct output.
 
how did that one compile? must be an internal kind of pure virtual...
 
you can call pure virtual functions during constructors and destructors, I believe
there is some way to do it, although it's contrived IIRC
 
but it shouldn't compile I would think...
...or maybe it's ok
anyho - into the debugger I go
 
@Xaade oh geesh. What a dork
 
@kfmfe04 I can't remember any hack to do it right now, but I have a recollection that it's not something you can do accidentally.
 
10:30 PM
@RMartinhoFernandes k - ty for the tip
 
People!
Hello there.
I do not know what to do.
 
@TonyTheLion that's kinda what he just said. "I'm aware that my [code] is crappy(unsic). Yet I'm fine with it."
 
Xeo
We don't know either.
 
Don't you think we lack some activity?
 
@Xaade yea, well then he has to solve his own problem. imo
 
10:31 PM
as a programmers of course, or is it just the case of individuals?
 
struct base { virtual void foo() = 0; void do_foo() { foo(); } base() { do_foo(); } }; struct derived: base { void foo() {} }; seems to be enough.
 
@TonyTheLion , I didn't mean problem, I solved it and if it proves to be successful, tommorow I will be payed 30000 dollars! :D
I meant about doing some activities
here in Tampa people don't hang up at all
which is really strange to my culture...
I do not have to talk to anyone except to this machine ...
the main and only activity is going to shopping. ..
 
Arrrghhgkjhgele. Fuck you GCC, or GRUB, or whichever tool is messing this up.
 
but I don't see anything interesting about it
Yesterday, I was wandering through the streets of the city, and found 14 people on my route through 5 blocks, :( . Today, through the same route I hooped on some Asian people relaxing in the park which was very cool, and we stood there for couple of hours talking about anything. I made some friends there, but I would make more if I encounter more people...
 
1
Q: C++, return const and non const reference to std::set item

justikThere is the class A containing two overloaded methods getItems(); typedef std::vector <int> TItems; template <typename T> class A { private: T a; TItems items; public: A(){} A ( const T a_, const TItems & items_) : a(a_) , items (items_) {} bool operator (...

 
10:40 PM
@TonyTheLion I like the part where he performs condition 0 1 and 2 16 times each in order, then default after that. Even if he fixed it to modular, he'd perform condition 0 1 and 2 once each, and default 13 times.
 
someone tell me that returning an iterator of a std::set of double' to a std::vector<int>` is wrong?
that's in regards the question I just posted
TItems is a vector<int> and is trying to assign that to a std::set<double>
huh?
no worries, I figured it out, saw it wrongly
 
Note to self: RTFM before blaming the tools.
 
Xeo
lol
 
10:59 PM
does he make a valid point?
 
what reaction are you expecting from me? :P
 

« first day (465 days earlier)      last day (4483 days later) »