« first day (232 days earlier)      last day (4731 days later) » 
01:00 - 23:0023:00 - 00:00

Xeo
1:00 AM
Eh? GCC 4.5.1 doesn't have std::being and std::end...
 
Xeo
@Johnsyweb Uhm, at least it doesn't work on ideone for me with std::vector
But that mail only says sth about valarray?
 
Ah. True.
 
1:18 AM
@Xeo 4.6 does.
Not std::being though :P
 
Xeo
argh :P
and argc and argv too!
 
@MartinhoFernandes I let that one pass. Shouldn't really in Lounge<C++> ;-)
BRB: Doctor Who's on!
 
Yeah, I was trying to keep on topic :)
 
Xeo
I wonder what std::being would do...
> on topic
 
Invoke Skynet?
 
Xeo
1:20 AM
> Lounge<C++>
 
> We give pedantry a new meaning.
 
Xeo
Hehe
True enough
And I even set that
 
I make that same typo all the time.
begin is harder to type for some reason.
 
Xeo
it's the flow on the keyboard
 
Yay, my BT client can trade handshakes! Only 90% of the protocol left now :(
 
2:19 AM
Anonymous down-voters make me sad.
 
Xeo
Not only you
 
@Xeo I'm sure.
I'm not so self-assured that I am always right and am always happy to be corrected (and therefore educated); so a down-vote without explanation leaves me wondering what it was I missed.
Case in point:
5
A: What data structure to use

Johnsywebstd::deque seems to meet all of your requirements. If performance is a real issue for you, you should read GMan's answer to Pre-allocate space for C++ STL queue .

 
2:38 AM
Incidentally, I seek not sympathetic up-votes, but enlightenment.
 
Xeo
I upvoted because your answer is correct from what I can see.
 
Although, we take what we can get! ;-)
 
Xeo
People on SO upvote far too little
 
Especially my answers ;)
 
:-)
 
Xeo
2:39 AM
Good questions and answers should always be above 8 IMHO. One just needs to read the little "tooltip" that pops up when hovering over the upvote button
People on SO mostly upvote because "this is what I needed!" or "hm, sounds interesting" or sometimes even "lulz, this is funny! +1"
Not for the reasons upvotes should really be given for
 
Indeed. "Useful" is key.
 
Xeo
Mostly, "researched and clear" is what I'm voting for on questions, because useful is subjective
On answers, I'm going for correctness and sometimes research
Of course, I'm also guilty of "okay, this was exactly what I needed" or "oooh, interesting!" upvotes, but who isn't? :)
Hmm.. 200 upvotes in the C++ tag needed for gold badge
 
I'm guilty of up-voting "appropriate" answers to silly questions.
 
Xeo
"appropriate" in the sense of "they answer whatever stupid thing the question asked for" or "they tell the OP the question is stupid but answer a little anyway"?
 
Stupid answers to stupid questions.
 
Xeo
2:48 AM
Heh
 
It annoys me a bit that I got as many upvotes for answers like this one as I got for this other one.
 
Xeo
Yeah, sometimes it's strange
 
Ha ha.
Similarly, this is one of my most up-voted answers: stackoverflow.com/questions/6226081/…
 
WTF?
> huhu..pls help me..this is my coding to pass my interview internship..
 
Quite!
 
2:54 AM
I hate people that try to get jobs they're not fit for.
 
One presumes that they didn't pass the interview.
 
If you don't know Python why would you interview for a Python job?
 
Xeo
Uuuhh, don't remind me of jobs.. I need to get one soon. >_>
But I'm bad at writing resumees and CVs...
 
@Xeo Are you just going to flash your shiny StackOverflow 10k flair?
 
Xeo
Nah
Bad idea
 
2:55 AM
I jest.
 
Xeo
I searched for that on SO and Programmers.SE :)
Thought of putting a link in my resumee, but didn't after searching
I'll just put a mentioning of SO on it
If they want to know more, I'll be happy to tell them
 
It appears it's common practice to "lie" in resumees.
 
@Xeo Sounds like a good plan.
@MartinhoFernandes It is. But lies are often found out in interviews.
 
On my second day, my boss told me he wasn't expecting me to be at home with Visual Studio, so he had to rearrange his plans for my schedule.
 
Xeo
@MartinhoFernandes And I don't understand why one would ever do that.
 
2:57 AM
@Xeo I'm not suggesting it.
 
Xeo
@MartinhoFernandes That should've been a full-stop, not a question mark..
On the upvotes of strange answers, this is one of mine for which I didn't expect so many upvotes.
 
Despite the fact that my resumee mentioned experience with C# and several .NET technologies.
 
Xeo
Though I now hope to get the Populist badge on that one. :)
 
I guess that was because of the ideone link.
People found that novel, for some reason.
 
Xeo
But I sure gotta admit I totally forgot about sizeof on static arrays of chars
 
3:01 AM
Ha ha. That is neat!
 
Xeo
I knew I'd get another upvote! It happens all the time when I post the link. :)
 
You still need 7 more and an evil downvote on the accepted answer, or 9 upvotes and no evil downvote.
I'm hoping for the latter.
 
The accepted answer uses parentheses with sizeof. Why do people do that?
Doesn't deserve a down-vote for that, though ;-)
 
Xeo
@Johnsyweb I'd rather ask why people do not.
And now someone upvoted on the accepted answer. :<
 
Some of my colleagues insist on doing this. They also put parentheses around return statements.
sizeof and return are not functions, people.
 
Xeo
3:05 AM
On return, I can't understand
but on sizeof, sure. typeid also needs parenthesis afaik
 
@Xeo Indeed. return sizeof typeid(x);
 
Xeo
lol
should always be 4 or 8, references and stuff
 
Not the most useful of return statements.
 
Xeo
I'm wondering if the compiler could optimize such stuff out...
and replace it with a simple return 4; // or 8 on 64bit
 
Probably
 
Xeo
3:11 AM
Should, the return of typeid(x) is always a reference, and the size of a reference is constant, so constant folding should apply
Btw, any thoughts from you on this question of mine ?
 
@Xeo I don't see how it could be anything but UB.
To draw a parallel from mathematics:
Zero divided by anything is zero. Defined.
 
But char* x = nullptr; delete x; is not UB.
 
anything divided by zero is not defined.
 
void* x = nullptr; delete x; doesn't have to be. Could be a no-op, like with other pointer types.
 
0/0 is not defined.
Despite zero divided by anything being zero.
 
Xeo
3:16 AM
My argumentation: You won't even get to the deletetion of the object part.
Because it is defined for delete 0; to be a no-op.
In C++0x it isn't UB, as that is too defined. "Any program that contains delete void_ptr; is illformed."
 
Sorry, must tear myself away from the laptop. The sun is shining, the birds are singing.
 
Xeo
Argh.
I always forget the () in operator()(types) ...
 
Xeo
3:49 AM
0
Q: What is the rationale on not allowing lambdas to deduce the return type if it contains more than one statement?

XeoTaken from the C++0x FDIS (n3290): If a lambda-expression does not include a lambda-declarator, it is as if the lambda-declarator were (). If a lambda-expression does not include a trailing-return-type, it is as if the trailing-return-type denotes the following type: if the compound-s...

I think I should start following the comp.lang.c++ mailing list..
 
4:05 AM
@Xeo I don't know what could be different, but the C# compiler will only fail to infer the return type of a lambda if it has various returns with inconsistent types.
Wait, there is one thing that is different. You cannot use implicitly typed variables with lambdas var x = () => 1;...
Because lambdas in C# can represent expression trees.
So you always have to make the type explicit.
 
5:04 AM
hi, en.wikipedia.org/wiki/Disjoint-set_data_structure can the bound O(nlog(n)) derived by a lay-man?
 
No. If you know what O(nlogn) means, you're not a layman. :P
 
hehe
@MartinhoFernandes the method of deriving, thats the problem
 
A T
hi
/clear
Does anyone have any ideas about this?
1
Q: C++ Web-framework with cookie and SQL support

A TGood Evening, I'm building a website which will will look something like this: So probably a widget-centred web-framework would be best... Which C++ web-framework supports cookies (for user-login [session] storage+config storage) and SQL (MySQL or SQLite)? Thanks in advance for any suggestion...

 
 
1 hour later…
6:48 AM
> In general, do not overload operators. The assignment operator (operator=), in particular, is insidious and should be avoided.
I know the Google style guide sucks, but this got me thinking.
What can be "insidious" with operator=?
 
7:02 AM
I wonder weather that lu1zsec is a false flag operation.
morning btw
0
A: Few basic doubts regarding caches

NilsJust one answer? Well 1.) No hardware implemented. They should be documented by the vendor, if not then microbenchmarking is an option. 2.) Hardware 3.) As pointed out above L1 cache has separate caches for data and instruction. There is also TLB for virtual memory. 4.) I attended a course l...

 
Xeo
@Johannes: I found one of your mails way back from january 2009 and at the end you ask if the standard guarantees that everything is fine when passing in a 0 pointer to the constructor of ostream
 
const int * blah means a pointer to const values, int * const blah means a const pointer to non-const values, but what about int const * blah?
 
Xeo
@Johannes In case you didn't find out yet, take a look at this answer of mine, where I used your example class and then after that the research through the C++03 standard I made. :)
 
@Nils int const * blah is the same as const int * blah.
 
ok
 
Xeo
7:37 AM
3
A: Platform independent /dev/null in c++

XeoEdit: Taken from @Johannes Schaub - litb's mail here with slight modifications: template<typename Ch, typename Traits = std::char_traits<Ch> > struct basic_nullbuf : std::basic_streambuf<Ch, Traits> { typedef std::basic_streambuf<Ch, Traits> base_type; typedef t...

I gotta admit, I really had fun hunting down those standard references. :)
 
 
3 hours later…
10:49 AM
@Xeo got the reference.
 
Xeo
11:02 AM
@Martinho no, you didn't. :)
 
@Xeo The explicit conversion to bool is used because of bool t(e) instead of bool t = e.
The standardese calls "contextual conversion" to what I called "calling the explicit conversion 'implicitly'".
 
Xeo
@MartinhoFernandes Ah, I overlooked that bool t(e) part, my bad.
 
But it seems like I misunderstood it a little. ! is really magical as you suggested at first. It invokes the explicit conversion all by itself. The standard reads "Certain language constructs ...". I took this to mean if/while/for.
But the operators that work on bools (!, &&, ||, ?:, etc) also do this.
§5.14 and §5.15 mention the contextual conversion.
 
Xeo
@MartinhoFernandes :)
No harm done though.
Since it doesn't work with relational operators.
Or does it?!
 
Xeo
11:17 AM
Good.
 
It really reduces the safe bool idiom to explicit operator bool() const;, no tricks required.
 
Xeo
That's nice
Can you add that find about the boolean operators in the answer?
 
Will do.
 
Xeo
Maybe also highlight that bool t(e) part
 
@Xeo ohh thanks for notifying
@Xeo it looks like I was able to verify it
0
A: cancelling std::cout code lines using preprocessor

Johannes Schaub - litbYou may just replace cout by ostream(0) like #ifdef NDEBUG #define cout ostream(0).flush() #endif This way, it works with both std::cout and plain cout, and ostream is available when including <iostream>. Writing into a ostream(0) is a no-op. The flush function call is done so that you g...

 
Xeo
11:34 AM
@Martinho, I like the next sentence that comes in the related standards paragraph. Did you by chance not include it willingly? :)
> The effect of either implicit conversion [...]
 
That sentence explains that the effect is that of making the conversion, while the previous ones only explain whether the program is well-formed or not. I should have included it.
The rest of the paragraph I decided to exclude because I think it detracts from the point at hand.
 
If A t(u); works, u is not in general "implicitly convertible" to A. even if A is "bool", this is not necessarily the case
"implicitly convertible" only refers to A t = u; I think
 
3
A: Conversion function for error checking considered good?

Martinho FernandesIn C++03, you need to use the safe bool idiom to avoid evil things: int x = my_object; // this works In C++11 you can use an explicit conversion: explicit operator bool() const { return is_valid; } This way you need to be explicit about the conversion to bool, so you can no longer do crazy ...

 
Xeo
> the condition of static_assert;
> the optional constant expression of noexcept;
How can that possibly be?
 
No idea.
 
Xeo
11:43 AM
Does the bool conversion need to be constexpr then?
 
what do you mean
what is that text from
 
Xeo
From @Martinho's answer
 
But the standard does mention it. I didn't even knew noexcept could take an expression.
 
Xeo
Which section(s)?
 
There is a noexcept operator. I.e noexcept(foo) like with sizeof that can take arbitrary expressions
and then the noexcept exception specifier, that can only take constant expression
 
11:45 AM
static_assert is on section 7 and noexcept on 15.4.
 
void f() noexcept { } or void f() noexcept(0) but not void f() noexcept(foobar not a constant expression here)
 
Xeo
> the constant-expression shall be a constant expression (5.19) that can be contextually converted to bool
 
There are some interesting ambiguities here, though
like, int(f()) && noexcept(0); is ambiguous: it can mean: "declare f to be a function with ref-qualifier && and noexcept exception spec" and it can mean "logical-AND the result of the int(f()) cast with the noexcept operator"
 
Xeo
Oh my god...
Johannes, don't make my head hurt like that while it's still midday!
@Martinho, what about the logical operators?
 
What about them? They contextually convert their arguments.
 
Xeo
11:51 AM
No, I was asking for standard sections. :) Found them already though
 
They're all in section 5.
Oh, and standard streams now use an explicit bool conversion (27.5.5.1) instead of their old clunky void*.
This is my first time spelunking through the standard.
I think I'm having fun, should I go see a doctor?
 
Xeo
I love doing that
Just look at my answer on the search if ostream os(0); os << "lol"; is well-formed
4 hours ago, by Xeo
3
A: Platform independent /dev/null in c++

XeoEdit: Taken from @Johannes Schaub - litb's mail here with slight modifications: template<typename Ch, typename Traits = std::char_traits<Ch> > struct basic_nullbuf : std::basic_streambuf<Ch, Traits> { typedef std::basic_streambuf<Ch, Traits> base_type; typedef t...

Double quotation!
 
Xeo
I like it when the tags, ordered lexicographically, form nice statements that I want to express
 
Xeo
12:02 PM
0
Q: Is the safe-bool idiom a thing of the past?

XeoThis answer of @Martinho Fernandes shows, that the safe-bool idiom is apperently deprecated, as it can be replaced by a simple explicit operator bool() const; according to the standard quote in the answer 4 [conv] p3: An expression e can be implicitly converted to a type T if and only if t...

tags: [c++0x] [deprecated] [safe-bool-idiom] :)
 
Xeo
is it really necessary to post every single question you ask in here?
I mean, really, we could all just .. .. look for it on the main site
 
Xeo
attention whore
but okay, since you asked nicely, I'll just hint that I posted a question. :P
But @DeadMG, you were fast disambiguating that "no" in your answer. :)
I just wanted to post a comment
 
well
your topic title and the actual question in the post pose two separate questions
 
The answer to one is "yes", and to the other is "no".
 
Xeo
Heh, yeah, I do that pretty often, unintended most of the time
 
Hmm, the @Martinho in @Xeo's oneboxed question shows green, but I didn't get a notification.
 
Xeo
@DeadMG Fixed that
> … but then I remembered that I was a programmer …
@JohannesSchaublitb lol'd at that part
 
Xeo
12:22 PM
Nice, open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2333.html lists all the places in the FDIS where I had to hunt down the paragraphes for the "contextual conversion"...
 
note that simply making an existing operator void*() explicit will not work with ! foo and such
 
Xeo
@JohannesSchaublitb For the language constructs as if, while, for ... etc?
Of course, the standard states that the type must be "contextually convertible to bool "
 
yes, but the conversion void* -> bool is not considered
 
No, it's the conversion T -> void* that isn't considered in the first place.
Because it's explicit.
 
that is, this will work: void const *p(x); (x is the class that has the explicit operator void*() ). But bool p(x); will not work
only qualification conversions are considered
 
Xeo
12:30 PM
Whatever it does, it does it correcl
*correctly
meh, damn keyboard
 
what do you mean?
I'm not talking about GCC or something
 
bool p(x) doesn't work because there's no T -> bool and T -> void* is explicit.
 
@MartinhoFernandes what I'm saying is that there is no T -> bool because operator void* is explicit
 
But if you convert x to void* explicitly, the result is again implicitly convertible to bool.
 
if you remove the explicit, then bool p(x); works fine
so explicit conversion functions have the additional constraint that only qualification conversions are considered.
 
12:36 PM
Hmm, so GCC is bugged? ideone.com/PY7dc
 
Xeo
Oh, btw @Johannes, you give me bad ideas. :)
I'm currently thinking of how to resolve the return issue
but I think I'm comming to the conclusion that it's not possible. :(
Hm. Is it possible to enable_if a conversion operator?
 
hello ppl
 
12:52 PM
@MartinhoFernandes yes GCC is bugged. see gcc.gnu.org/bugzilla/show_bug.cgi?id=47080
 
I need some advice from you, I am looking for a tool in which it takes my code as input (C) and returns me a messy code, yet functional
 
@Wilhelm You mean a C-obfuscator?
 
hm?
@Johnsyweb exactly
 
@Xeo you can use default function template arguments
 
12:55 PM
@Wilhelm The top hit on Google is a paid-for solution. I guess you are looking for FOSS?
 
@Johnsyweb yeah... since I'll use it just once
 
> Revision history: Accidentally deleted a line then used "undo" to bring it back again.
lol
 
Xeo
@JohannesSchaublitb Ah, but that's C++0x right?
@MartinhoFernandes That PDF is pure gold
 
not possible in c++03
 
Xeo
> Job Security Index = 1 / Maintainability
 
12:58 PM
@Wilhelm For a once-off, this may suffice: download.cnet.com/Mangle-It-C-Obfuscator/…
@Xeo I think I know some people who work on that principle :-(
 
@Johnsyweb yeah, thank you!
 
@Wilhelm No worries.
And with that, I'm off. G'night folks.
 
Good night.
 
Good night
 
@Xeo: This one is a classic: How to Write Unmaintainable Code.
 
Xeo
1:04 PM
> You might get the idea that every language feature makes code unmaintainable -- not so, only if properly misused.
"only if properly misused" -- now that sounds wrong.
 
> marypoppins = (superman + starship) / god;
 
Xeo
> Maintenance coders, without your firm grasp of German, will enjoy the multicultural experience of deciphering the meaning.
That guy is evil!
> Hungarian Notation is the tactical nuclear weapon of source code obfuscation techniques; use it!
Yep, definitly evil.
All those guys using hungarian notation out there do it because they want to keep their job, not because they like it!
 
> If, for example, you were writing an airline reservation system, make sure there are at least 25 places in the code that need to be modified if you were to add another airline. Never document where they are. People who come after you have no business modifying your code without thoroughly understanding every line of it.
 
1:19 PM
by the way
I have a puppppyyyyyyy
 
I thought you were a puppy :P
 
nope
my sister sent me videos of my puppy and now I just want to go home and cuddle her
2
 
 
1 hour later…
2:48 PM
yo ho ho and a bottle of rum.
@DeadMG cuddle your sister?
 
no
my puppy
2
 
3:32 PM
lol
 
3:42 PM
anyone here ever use rackspace cloud? Trying to connect to mysql database and in an email I was sent this as the hostname: mysql50-33.wc2.dfw1.stabletransit.com, but it could not connect to that.
 
4:25 PM
Hrmm it seems I have exactly the same problem, but no answers so far :(
http://stackoverflow.com/questions/6061491/thrustsort-very-long-compile-time
Also thrusts code looks quite insane..
 
hello,any 1 here
?????
 
4:41 PM
@Alfred, just Wilhelm Conrad Röntgen and Sully Prudhomme ;)
 
@AProgrammer,............what
hey...can you help me out
 
@AlfredNobel Two Nobel Price laureates...
 
hmmmmmm.......i said,will you help me out
 
@AlfredNobel If you don't state what you want, it's difficult to be sure that we can help.
 
ok.....i have started studying C ,since last two months,&today at stackoverflow,i came to know that c++ is more preffered than C these days,would you help me to select an appropriate book for ir
@aprogrammer
 
4:47 PM
That one is easy:
499
Q: The Definitive C++ Book Guide and List

grepsedawk This question has historical significance, but is not a good example of an appropriate question. Read and learn from this post, but please do not use it as evidence that you can ask similar questions. See the FAQ for more info. Provide QUALITY books and an approximate skill level. Add ...

 
@AProgrammer,LET Me hv a look at it..:)
 
Apparently I'm not the only one that bought Ivor Horton's "Beginning Visual C++ 6" as his very first programming book. (theatlantic.com/technology/archive/2011/06/…)
That was back in 1999 :D
 
:D.....i want a book,with latest standards in programming
c++
 
Xeo
5:23 PM
I hope I'm note the only one that thinks this guy didn't understand how threads and join() work?
Or maybe I don't understand how they do. I just had a pleasant nap all of a sudden and am still not really awake.
 
@Xeo I don't think it is you who has a problem.
 
somethings weird about those joins....
not sure why you'd join there
 
@Tony because it is at the end of the scope for the thread variables ;)
 
@Xeo His usage of join() there removes the benefit of using multiple threads.
 
5:46 PM
But you knew that ;)
 
6:28 PM
hi
 
6:58 PM
geez. What do you say when someone claims that, literally, "code reuse is ALWAYS an advantage"?
 
I fear I'd stay speechless.
 
Xeo
@jalf With what meaning of "reuse"?
 
@Xeo Use LAPACK when you need to multiply two 2x2 matrices.
 
@Xeo none. Any. No qualifications or context whatsoever, just "code reuse is always an advantage"
 
Xeo
Then, the ever so popular "Well, depends." :)
 
7:31 PM
@AlfredNobel So I do.. I guess you just have to be patient..
Wondering if there are any books announced..
 
8:01 PM
evening all
 
evenin
 
what's new?
 
I'm a fat lazy slob who's gonna fail university
oh wait
new :P
well
hopefully, soon, I'll get my test results back and be un-sick
also
I had an idea about solving subset sum problem in polynomial time, for positive integers only
 
I figure that you could use partitioning and inequalities to reject the vast majority of possible combinations in advance
 
8:54 PM
@DeadMG oh interesting
 
not as interesting as I'd hoped
the number of partitions for n is still NP
although vastly less than the theoretical number of combinations
by hundreds of orders of magnitude, for even moderately large n
but I've also been thinking
if you have a target T, then logically, there are maxima and minima in the size of the subsets that it's possible to generate it from
specifically, the minima would be the size of a geometric series 1,2,...
maxima would be data-set dependent
uh, wait, I mean the other way around
 
hmm, you might have lost me there
lol
 
well, think about it
if you want a series of (unique)integers to sum to a target, then even picking the smallest integers possible, there's going to be a point where you reach over the target
therefore, any series above that point mathematically can never sum to the target
I figure that this must impose a hard relation between the target T and the complexity resulting from the size of the input, N
 
9:38 PM
so, speaking pedantically, I'm pretty sure the topic line is wrong
or how exactly do we give pedantry a new meaning?
 
by being very pedantic about non pedantic things
or browsing reddit endlessly and therefore having no life :(
 
@TonyTheTiger but how is that a new meaning to the word?
Or one given to it by us?
 
Xeo
10:15 PM
May 30 at 12:22, by Xeo
@Johnsyweb We are quoting standards, you know? How much more pedant can it get?
Just take that title as a joke, like, nobody will ever get as pedant as we. :)
 
hi guys ;)
I need your little help, with filling a survey: stackoverflow.com/questions/6242667/…
I need this to my master's degree work, so this is very important to my ... :)
 
10:36 PM
can anyone tell me what this means?
1>AppointmentSerializer.obj : error LNK2001: unresolved external symbol "public: static class std::vector<struct Appointment,class std::allocator<struct Appointment> > AppointmentSerializer::appointments" (?appointments@AppointmentSerializer@@2V?$vector@UAppointment@@V?$allocator@UApp­ointment@@@std@@@std@@A)
 
Xeo
No implementation for static vector<Appointment> appointments; in class AppointmentSerializer
You need a vector<Appointment> AppointmentSerializer::appointments; in any .cpp (only 1 though)
 
worked ty!
 
10:53 PM
That's pretty weird: it appears that in T t { expr0, ..., exprN }, the order of evaluation of the initializer expressions inside the braces is guaranteed. Even if T is a class and this results in a constructor call.
I checked on this while looking around for a way to (ab)use variadic template pack expansion.
 
Xeo
@LucDanton You know, it's interesting. Everyone wants to abuse the features in C++(0x). :)
 
@Xeo I'm trying to write a compelling use-case and I'll probably open a question
 
01:00 - 23:0023:00 - 00:00

« first day (232 days earlier)      last day (4731 days later) »