« first day (372 days earlier)      last day (4559 days later) » 

12:00 AM
Neat. Okay, anyway. I have a petty C question, but don't think it warrants it's own SO posting. Is there a better room to ask than here?
 
The password however is "singleton".
 
::writes it on a post-it stuck to his monitor::
 
It will get you in the group of elites.
 
ALLSOME.
 
You're evil.
 
12:03 AM
You should ask your question on SO though because there are many people there eager to answer your question in order to gain rep. While here nobody really cares.
 
Heh, true. But it's a little quicker turnaround here. :-D
Usually. :-|
 
Most of the regulars are from Europe. And it's 2AM here.
-ish.
 
Anyway, I'm just wondering how I get ceil(A/B) if A and B are ints. Do I need to cast the expression as a float first, before I send it to ceil()? Or if A and B are ints, does A/B do some standard ceil() or floor() automatically? (or is its behavior undefined?)
Sorry, I didn't describe that very well... Is it clear at all?
 
> When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded. 88) If the quotient a/b is representable, the expression (a/b)*b + a%b shall equal a.
C99.
Though it probably didn't change in C11.
 
Oh, okay. So it's basically a floor function?
 
12:10 AM
Yep.
 
C1X, dunno if it were released after all, or not yet.
 
Okay. I'm just using gcc on my school's machines. How do I find out what standard I'm compiling to if I'm not specifying it explicitly?
 
It'd be pretty stupid for integer division to be UB.
gcc defaults to GNU C89.
I.e. C89 with all those silly GNU extensions.
 
Yeah, stupid for it to be completely undefined. I just was worried maybe some compilers floor'd it and others ceil'd it.
 
Variable length arrays are supported by default GCC and they are a C99 feature.
 
12:12 AM
There are preprocessor macros to tell the version.
 
Oh, okay. I'll look those macros up.
(I've got that "google" program installed on my internet)
Thanks!
 
So Google has a website these days?
 
Yeah. I'd look up the url for you, but I don't know where to search for it!
 
Why doesn't the internet have an iterator? I can't access any page without knowing the domain names beforehand. How silly is that?
 
Just try 'SELECT url FROM INTERNET WHERE title LIKE '%oogle%';
Just tried it in my address bar, but it's taking a long time to load.
 
12:27 AM
@loneboat On Bing, duh.
 
Sorry, can't read that. SO chat changed it to: On <expletive deleted>, duh.
 
12:41 AM
lulz
organverkauf
 
What do "Gehirn" and "Armwunde" mean?
I would think "Armwunde" means "arm wound", but that doesn't make sense in this context.
 
yeah weird
finger means .. finger. auge means eye. ohr means ear. gehirn means brain.
you can buy organs there haha
 
It could be a halloween-themed candy shop.
> There's a logical explanation for everything.
^ Does above statement require proof? Or is it inherently correct?
 
12:57 AM
Define logical explanation first.
 
1:09 AM
Never mind. I predict that frustration will be unavoidable if this discussion is continued.
 
@StackedCrooked if it could be false then you need a proof for it to be proven true
 
That goes for any statement.
Lately I often skip words when writing a sentence. I wonder if my brain is deteriorating.
It think it can be proven by proving that the opposite is false. (What's the name of this technique again?)
I think I'll check out this anime. The plot seems interesting:
> In a reign ruled by the Tokugawa shogunate, breasts mean everything. If you have breasts, you are guaranteed wealth and popularity. If you lack them, you are rarely considered "human". Members of the ruling Manyu Clan help raise the future big breasts. Written on a secret scroll possessed by the clan, there is said to be various techniques on how to grow big and beautiful breasts.
> Chifusa is to be successor of the clan. However, she takes the secret scroll and runs away with it, hoping to fight against the cruel world that the Manyu Clan has created...
 
1:28 AM
sick :(
 
What did you eat?
 
too much
 
This too shall pass.
 
evening people
 
Evening.
Two years ago I had horrible cramps each time I ate fish. The suffering lasted for 2 hours I think. I tried to distract myself with gaming or something.
 
1:33 AM
Futurama
I just finished downloading like, 25GB of the stuff
 
Cool.
I haven't seen most of the episodes yet.
 
me neither
 
 
3 hours later…
4:21 AM
@DeadMG 25 GB of fish?
 
 
1 hour later…
5:46 AM
@AlfPSteinbach I use both. I think the two are orthogonal.
 
Als
Hello @RMartinhoFernandes
 
Hi.
Haven't seen you for a few days.
 
Als
yes,just a couple of days i think
and otherwise maybe the time diff playing up.
err..Have you set up a Abstracted Robot Factory? I see a Obscure Robot Guy!!
 
What do you mean?
Oh, there's a starred message.
 
Als
Oh yes!
New guy...funny he chose the robot name, now we have 2 bots :)
 
6:00 AM
Neat, there's a new edition of The C++ Programming Language coming up.
It's a bit more pricey than the Third Edition though :(
 
Als
covers C++11?
 
Probably.
Would be a bit silly of Bjarne not to.
 
Als
I am quite interested in an book which will delve in to C++11 actually
 
Only out next year though.
Other than that, the only other book covering C++11 that know of is that one about concurrency.
That one probably doesn't touch everything though.
 
Als
Its strange that no real books covering C++11 are out yet.I distinctly remember there was a mad scramble of Android books as soon as it came out.
Yes I know the concurrency book,due for a long long time actually
 
6:03 AM
You know how it is with marketing.
 
Als
Yes,but why so much of an delay, there are so many of the members of the standards committee who are capable enough and have the knowledge of new features
 
How many of them write C++ books?
 
Als
And not to mention the other expert non-standards committee members.
 
The concurrency book is out next month. And less than 30 pounds :)
 
Als
@RMartinhoFernandes: Well, that is what I wonder at this point of time. Only few, and fewer who are popular writers actually
 
6:06 AM
Actually, I've seen a few more books covering C++11.
But crap.
C++ without Fear for example. The one that exemplifies nullptr using strtok. Shivers.
 
Als
:)
 
If you buy a programming book called XXX without fear, you shouldn't be programming
 
Als
@RMartinhoFernandes: At this moment and as even you had suggested once wikipedia + Bjarne web page seems to be the best source
Yay now we have 2 bots jamming in the same room!
 
derp?
oh
/me whips out his axe
..plays a tune with only three different chords
 
Als
@ObscureRobot: uhm Are you sent back in time or something to eliminate the resident bot here?
 
6:09 AM
shhhhhh
 
@Als Yep. And you will probably also want to browse the second half of the standard a bit, because there's a lot of new library stuff.
 
how am I supposed to gain his confidence now?
 
@RMartinhoFernandes Way to miss the point.
 
Als
@RMartinhoFernandes: Thanks on that tip :)
@ObscureRobot: Give him a Robo Hug :P
 
@ObscureRobot XXX with fear?
 
6:11 AM
S&M?
 
@ais good call
C++ for the easily aroused
 
A lot of programmers are afraid of using exceptions so "Exceptions without fear" might be an appropriate title for a book on error handling with exceptions.
 
Exceptions are a lot less scary than farting officemates
 
I cringe everytime I see "I have exceptions disabled ..." or "This is fine, but sometimes people disable exceptions and ..."
 
at least you don't have to handle exceptions with your nose
 
6:13 AM
@ObscureRobot True.
 
Als
Actually,I just noticed @ObscureRobot is a Java Programmer, Folks(@RMartinhoFernandes, @StackedCrooked) load'em up, You know what we do best to Java programmers.. :P
 
If I buy the concurrency book from Manning, I can view at the all the chapters right now. Trouble is, it's more expensive than Amazon, and I'll have to pay the same or more for shipping. Damn.
 
heheh, I only touch java when bribery is involved
I do have a mildly awesome AWK story though
which concurrency book?
 
hmmm
 
6:18 AM
Is there a reason for that cover? I think they should stick to animals for unrelated cover art. Unless O'Reilly has patented that.
 
@LucDanton Manning always uses pictures of people from the past.
 
I don't see a preorder page for kindle :(
 
It makes no sense that it costs more from the original publisher than from Amazon.
 
You know Tim O'Reilly and his patent lust
amazon discounts the fsck out of stuff
 
And gives me free shipping.
 
6:20 AM
publishers believe Suggest Retail Price is a thing
[ask me more questions about amazon in 3 years]
 
And there's the pre-order price guarantee...
Amazon just rocks.
 
and yet Amazon is mostly a Java shop...
 
That's irrelevant. I don't code for them.
I buy from them, and they give me awesome conditions.
 
sounds like a win for all involved
 
6:27 AM
@RMartinhoFernandes Heh in France books are mandated to be sold at the same price everywhere.
 
Germany as well
 
And who sets the price?
 
publishers
 
The editor. What he said.
 
vendors can't discount
which is probably why Amazon gave everyone in Germany who ordered a copy of Harry Potter 7 on release date a chocolate croissant
 
6:32 AM
They sent a croissant by mail?
 
special deal with deutsche post
trucks picked them up from bakeries
 
6:45 AM
how is variable incremented? </sigh>
 
Where did you see that?
Get used to it btw... :(
 
just a generic comment
I love it when people copy-paste their homework
Here, let me help you scam your way through an expensive education in a way that will prevent me from ever hiring you when you get out the other end!
 
Anyone knows where I can find the TR2 proposals? Are those public?
 
oh wow, I don't even know what version of tr I'm running on my box
 
Probably TR1. There isn't another one.
Yet :)
 
6:51 AM
`$ tr --version
tr: illegal option -- -
...`
heh
 
</badjoke>
 
@RMartinhoFernandes They're not consolidated in one 'section' or anything, I think that when someone says 'TR2 proposals' they really mean 'those proposals that we would use to make a TR2'. So they're really ordinary proposals.
 
Ah.
The Boost.Any proposal reads TR2 in the title: open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1939.html. Maybe I can coax Google to make me a list.
 
how often do people ask for polynomial-time solutions for NP problems?
siri, ask google to make me a list
 
6:55 AM
Very often.
And very often they get answers.
A lot of NP problems have polynomial-time solutions.
 
ok, Imma get a turning award by trolling
 
@RMartinhoFernandes There's a filesystem paper with 'TR2' in the title.
 
for the general case?
 
@ObscureRobot What general case?
 
of the problem - I can see how NP problems could have polynomial solutions for speical cases
 
6:57 AM
@RMartinhoFernandes Like so?
 
Yes, many NP problems have polynomial-time solutions for their general cases.
 
s/np/np-complete/
 
Extending to the whole WG21 part of the site (also URL) seems to get good results.
 
@ObscureRobot :P
 
put another derp on my tab
and I'll explain how to increment variables five more times
 
6:58 AM
Looks like Boost.Any is proposed for TR2.
Whoah, that's a rough proposal.
 
Seems like Asio too.
Also, why is there a proposal for Any, but not Variant?
The fuck dudes, variant is much cooler.
 
While some of the use cases overlap, they don't really do the same thing.
Also, as usual, the reason is 'because nobody wrote a proposal'.
 
If I have to pick one over the other, I want variant first.
 
Well in the Any paper there's an example of a virtual function in an interface that accepts any. If you want a stable ABI then that fills the need better than Variant if you want to remain open-ended.
 
Yes, I know any has its uses and advantages.
Strong candidates for TR2 include:
* Filesystem (accepted)
* Thread support
* Date and time
* Network file support
* Consistent system/OS error reporting
* Range-types, to complement iterators
* String algorithms
* Optional/Nullable values
* Range-checked numeric-casts
* 'Lexical' casts
* typesafe 'any' class
* interval arithmetic
* Unlimitted precision integer type
Neat stuff in there.
 
7:04 AM
What is thread support?
 
This is from a 2006 document, so it's probably what we have now.
 
Figures, the consistent system/os error reporting is also in then.
 
Bigints + intervals = infinite fun or infinite headaches, we shall see...
 
There's also a proposal for a C++-y alternative to VLAs (as in, stack allocated fixed runtime-sized arrays, not std::vector).
 
7:09 AM
Is the network file support basically boost::asio?
 
@RMartinhoFernandes Linky linky.
 
@Potatoswatter 'Network file support' wouldn't accurately describe what Asio does, so I think this is something else.
 
asio is broader, but I dimly recall seeing a TR2ish paper like that.
 
7:13 AM
hmm, says it's orthogonal to asio, and supports synchronous networking (yikes).
 
Stack overflow is the best google front end ever
 
Orthogonal to asio? A quick glance at the TOC reveals a lot of familiar names (io_service, acceptors, etc).
 
@RMartinhoFernandes I think that paper is overly optimistic, in the sense of export where there is no guarantee that implementations will go out of their way to allocate memory locally.
 
well, orthogonal to actually having multithreading and asynchronous i/o
 
has been nice, time for me to sleep
 
7:18 AM
> Therefore, we propose to define dynarray so that compilers can recognize and implement construction and destruction directly, without appeal to any particular standard library implementation. However, to minimize the necessary burden on compilers, we propose that dynarray can be implemented as a pure library, although with lost optimization opportunity.
 
Considering an 'easy' alternative to VLAs is having a scoped allocator that is fed memory from a system-specific alloca-like function. You get the full power of regular container that way.
 
It leaves it to QoI I think.
 
Which I think is a bad idea.
 
What's the reason alloca was never standardized, anyway?
 
I suppose VLAs are the result of that, for C?
 
7:20 AM
Right, you don't need alloca in C.
 
LOL, you don't need alloca if you have VLA's... guess which is more portable, in practice.
 
Do the major compilers support alloca?
 
@FredOverflow My manpage suggest it's not just up to the compiler, but also the machine.
 
@FredOverflow yes, but they differ regarding error handling
 
I would guess return value?
 
7:22 AM
Yes, every major target supports some form, but restrictions vary. You're best off not doing it in a loop.
 
@FredOverflow no it depends
 
too bad :(
52
Q: Why is alloca not considered good practice?

VaibhavAlloca allocates memory from Stack rather then heap which is case in malloc. So, when I return from the routine the memory is freed. So, actually this solves my problem of freeing up of dynamically allocated memory . Freeing of memory allocated through malloc is a major headache and if somehow mi...

 
some people have argued against alloca on the grounds that "you can" pass a fixed maximum size buffer down the call chain. i think that's impractical though.
 
> The alloca() function returns a pointer to the beginning of the allocated space. If the allocation causes stack overflow, program behaviour is undefined.
ouch
 
@AlfPSteinbach Yes, alloca is only useful in applications where that can't be done, such as crunchers/compilers and embedded systems.
 
7:25 AM
@FredOverflow Same thing happens with a big enough recursion :)
 
Could I use alloca in C++, or would that somehow conflict with RAII or whatnot?
 
@FredOverflow Yes, well what do you expect from stack overflow? Lol... the point is to avoid SO from a fixed worst-cased big buffer.
 
love stackoverflow, hate stack overflow
 
@LucDanton Or with big enough arrays.
 
@FredOverflow It's raw memory, so you'd have to manage lifetimes yourself. So no, no conflicts per se.
8 mins ago, by Luc Danton
Considering an 'easy' alternative to VLAs is having a scoped allocator that is fed memory from a system-specific alloca-like function. You get the full power of regular container that way.
 
7:26 AM
@FredOverflow See your compiler manual. There are more things for it to conflict with, so it's definitely less likely to do what you want.
For example, likely to break exception unwinding.
 
Anyway, I'm off to the baker.
 
^ Eggs and bacon in new-fangled composition. I'll just fry myself an egg or 2, and bacon!
 
Concepts are out, so it won't be coming any time soon :)
 
@RMartinhoFernandes On the other hand, is that really too much to ask?
 
7:28 AM
In a comparison like this if( expr_a != expr_b ) { /* .. */ } is it required that expr_a is evaluated before expr_b?
 
LOL, is that just a formalization of the Concepts demo code?
 
@LucDanton I don't think so, but many would just run upon sight of the words.
 
@Praetorian NO NO NO
 
In general don't rely on a specific evaluation order.
 
I don't either, I pointed that out to someone in an answer and he argues about how C++ is parsed left to right and so his hack is more efficient
As if parsing has anything to do with generated code
 
7:30 AM
Well, it isn't.
In fact, some platforms evaluate function parameters right to left.
 
0
A: Comparing to items in an Array c++

Aadit M ShahTry the following code: #include <iostream> int isSuccessive(int * array, int size) { size--; for (int i = 0; size--;) { if (array[i] + 1 != array[++i]) { return 0; } } return 1; } int main() { int size = 5; int array[5] = {1, 2, 3, 4, ...

 
I have spare downvotes.
 
Haha, I do too, but I really use those sparingly. His code works, but only because the comparison arguments are being evaluated left to right
 
You mean this?
This?
 
Exactly!
 
7:36 AM
Nice.
 
@Praetorian I want downvotes on comments.
 
Just downvote the answer.
If it involves UB, it deserves it.
 
> my array goes from int values to ascii and gets all funky and doesn't work
lol
 
> my car goes from 0 to 100 and gets all funky and doesn't work.
 
@FredOverflow Yeah that is a hilarious description. And the array.size() expression. Sometimes I feel most of the people asking questions on SO don't actually have a compiler installed on their computer
 
7:50 AM
I don't own a compiler.
Well, I do own a compiler for MSP++, but that is a language invented for a college assignment.
 
Better?! :)
 
8:09 AM
nice notation for unused argument: (void)focus;
i don't know why i bothered to define an inline function for that earlier
 
I want to add a few improvements to this post.
I had 3 guidelines:
1. Catch exceptions from the top down.
2. Throw exceptions from the bottom up.
3. Refine where needed.
And my improvements are:
* Logic errors are fatal and should therefore only be caught by the main function. (Maybe also in the thread-entry point.)
* Only catch the types that you need to handle. (This implies that you need to define different exception types for different error conditions.)
* Combining the first guideline (catch from the top down) with previous improvement leads to a fancy new rule: "Catch by maximum scope and minimal type."
* Get the error message from the exception type. Get the message arguments (if any) from the constructor.
Any objections?
 
@Praetorian Well, there's ideone for that...
 
8:34 AM
-1
Q: c++ other ordered set implementation then std::set

VladpIs there another good library with ordered set except std::set?? I'm using std::set now, but it's TOO limited: I have two types of objects(derived classes) and when I'm inserting them as their base class the set only accepts or 50 objects of the first type or 1 of the second type... it is seems t...

> std::set has a REALLY bad implementation
 
@StackedCrooked Have you considered adding a bounty to get an awesome answer?
 
@RMartinhoFernandes not yet
@RMartinhoFernandes I hesitate to do so because it's a bit of an open question. If I add a bounty then I'll have to eventually select one of the answers as the "best" one.
 
You can award bounties without accepting the answers.
 
I see.
In that case the highest rated answer will receive half of the bounty. This might be a little frustrating for him/her.
 
Hmm, no, that's no longer how it works.
You can award the full bounty to any answer regardless of votes.
Votes only matter if you forget to award it and the timer expires.
 
8:50 AM
That's what I mean. I have to accept an answer and I might want to prefer to leave it open in order to expand on it later.
 
No, you don't have to accept an answer.
There's an "award bounty" button, and an "accept answer" button.
 
Ah. I didn't know that.
 
Other than the timer expiration clause, it's pretty much orthogonal.
In fact, anyone can start bounties on any question now.
 
Interesting.
 
Hey, do you see a comment calling people idiots in this question: stackoverflow.com/q/7865133/46642?
I flagged it and it went out immediately. I wonder if it's just hidden from me because I flagged it or if I cast the final flag.
 

« first day (372 days earlier)      last day (4559 days later) »