« first day (455 days earlier)      last day (4498 days later) » 

4:00 PM
private inheritance is composition, isn't it?
 
@FredOverflow Yes, at least that's what I read in Effective C++ item 39.
 
@StackedCrooked What are your favorite items in Effective C++?
 
Long time since I read the book. Let me have a look at the toc.
 
The only correct answer is probably "all of them", anyway ;)
 
One thing I remembered was that interfaces should be minimal and complete.
It was not even a seperate item. Just a remark.
 
4:05 PM
2
Q: Getting more than I bargained for

smallBUsing the code below in order to get names of my drives: const DWORD buffer_length = sizeof(DWORD)*CHAR_BIT; WCHAR buffer[buffer_length] = {0}; GetLogicalDriveStrings(buffer_length,buffer); std::set<wchar_t> drives_letters; for(auto e : buffer) { drives_letters.insert(e); } I'm...

lol funny title
But this is still unbeaten:
 
Sometimes I do break the "minimal" rule. For example a rect class is complete if it has methods to get x, y, width and height. I like to add methods: top(), bottom(), left(), right() simply for convenience.
 
97
Q: Throwing the fattest people off of an overloaded airplane.

IvyMikeLet's say you've got an airplane, and it is low on fuel. Unless the plane drops 3000 pounds of passenger weight, it will not be able to reach the next airport. To save the maximum number of lives, we would like to throw the heaviest people off of the plane first. And oh yeah, there are milli...

 
@FredOverflow :)
@FredOverflow It's not only a funny title but also an interesting question.
 
@StackedCrooked Agreed, but I always have to giggle hysterically every time I read the title :)
 
Is there anyone on earth who has more rep. than Jon Skeet?
 
4:12 PM
@IntermediateHacker Future Jon Skeet? But honestly, no.
 
27
Q: Singleton by Jon Skeet clarification

amuthapublic sealed class Singleton { Singleton() { } public static Singleton Instance { get { return Nested.instance; } } class Nested { // Explicit static constructor to tell C# compiler // not to mark type as befor...

 
Look, @Johannes is top 25!
 
@jalf is on the 2nd page.
Good work @Johannes !
 
4:16 PM
Only 1610 points difference to Eric Lippert!
 
i will lipp him xD
soo near, i must take advantage of that
 
Go rep whore, go!
 
Is there any chance getting some help with semaphores?
 
4:19 PM
I've been siting on this for a few hours with out understanding some of the basics
 
Is it a theoretical problem or a code problem?
 
theoretical. My code works and does what it suppose to do, i just don't understand some of it :\
 
@JohannesSchaublitb If 100 answers of yours get accepted, you get 1500 points, then you're almost there!
 
@Buxme Are you a Java programmer? ;)
 
4:23 PM
Lol.. no :)
 
19
A: Hidden Features and Dark Corners of STL?

vehomzzzI like the little-known operator "-->", also know as "goes to." Here's an example: #include <stdio.h> int main() { int x = 10; while( x-->0 ) // x goes to 0 { printf("%d ", x); } }

What does "goes to" have to do with the STL?
 
There is a tale where a king must choose a wife. He wants the bride that comes with the most money (the family of the bride provides a sum of money). The king cares only about money, not about beauty or personality. There are 100 candidate brides. The procedure is that a candidate bride enters his room and tells him how much money she can offer. The the king must decide to either reject her or to marry her. This choice is irreversible. How can he maximize his profits?
 
@FredOverflow i downvoted. sadly there is no goes-down operator :)
 
@StackedCrooked By rejecting the first 37% and then chose the next better one?
 
I need to print the numbers 1 to 100 using 5 semaphores , i don't understand how semop() works in my code. here it is: dl.dropbox.com/u/17838/new2.c
 
4:25 PM
or can we say ~^ xD
 
@FredOverflow I don't know the answer myself. I heard the riddle from a former colleague and he didn't provide a solution.
 
The code works and the numbers are printed i just don't understand how semop tells the other semaphores to wait etc'
 
@StackedCrooked I read something similar in a famous math book about finding the perfect mate.
a great book btw
 
@FredOverflow That looks great!
 
I would really appreciate any kind of help
 
4:27 PM
@Buxme Have you tried pressing F1? That usually helps ;)
@Buxme Also, posting a link to your code on ideone is better than providing a link to Dropbox.
 
There is no F1 in ubuntu and i need to run it in linux
oh, i can post the code here?
 
Yes, and then you paste the link here. We love ideone.
 
ProjectFred HAHA
 
ideone.com/s10AQ for some reason in ideone it prints the number wrong
 
funny nicks you have
 
4:34 PM
but when i run it in linux gcc the numbers are printed from 1 to 100
I don't understand line 63, what the senop does there and lines 82,83,89. Don't read the comments there , i'm pretty sure i got them wrong
 
Hey cool, I just discovered the currency converter extension. If I now visit amazon.co.uk it shows the prices in EUR instead of in pounds.
 
Anyone?
 
4:53 PM
I have never used semaphores in my life.
 
hmm
there are probably a lot of semaphores in your head by that level of parallelism of the brain xD
 
I swear, i'm trying to figure out those 4 lines for the last 5 hours
 
5:08 PM
it's C and it's too long to read
 
it's ugly C, poor design, global variables, etc
although admittedly, "it's C" would usually encompass all of those things
 
Thanks
 
 
2 hours later…
sbi
7:07 PM
> you're displaying a disturbing dedication to rules. We're engineers—we're supposed to be smarter than that. If the rule isn't working right, then we need to tweak it. Blindly following rules might be appropriate if we were working on an assembly line with dangerous equipment. But we're not. Let's focus on optimizing the rules, not just blindly following them. — Adam Rackis
 
7:18 PM
@sbi it's just the usual mindset that discussion does not have a lasting value and does not have value for other than the participants.
 
sbi
@AlfPSteinbach Yeah, that's a good summary. That attitude feels so Merkin.
 
sbi
@AlfPSteinbach Well, I'm not referring to a pubic wig here. :)
 
Jacob Ezra Merkin (born 1954) is a former money manager and financier. He was a close business associate of Bernard Madoff, and is alleged to have played a significant part in the Madoff fraud. He served as the Non-executive Chairman of GMAC until his resignation on January 9, 2009, at the insistence of the U.S. government. He was the general partner of Gabriel Capital LP, a $5 billion group of hedge funds which was dissolved in 2008 after heavy losses in the Madoff fraud. On April 6, 2009, Merkin was charged with civil fraud by the State of New York, for "secretly steering $2.4 billion...
?
 
sbi
@AlfPSteinbach You linked to the explanation: "b) A citizen of the United States of America..."
 
7:33 PM
[*] Power Management support
[ ]   Legacy Power Management API (DEPRECATED) (NEW)
-_-
 
oh, a merican
 
 
1 hour later…
user142019
9:05 PM
lol nobody here
 
user142019
that's rare
 
sbi
Yeah, almost creepy.
 
9:36 PM
I answered a question over in clc++.
I think it was nice that the Visual C++ team (or apparently that's who they are) linked to my blog posting about how to configure the beast. I think few developers are aware that it can be done. But this raises question if I should also discuss how to use the MSBuild system etc. to make customizations more permanent?
 
 
1 hour later…
sbi
10:59 PM
Now that's what I call a dead room. An ex-room, really, it snuffed it, is no more. It has expired, ceased to be. The room is gone to meet its maker, bereft of life it rests in peace, and its metabolic processes are a matter of interest only to historians.
4
 
whole C++ is dead
 
sbi
...looks at his editor...
I think you're wrong.
It still wiggles over here.
 
it's zombie. C++11 added wings to that corpse, but it won't fly...
 
braaiiinnnsss....
 
right mood to write some ugly C++ code...
 
sbi
11:13 PM
There's never a reason to write ugly code.
 
no. there is one - I can't write better code
btw, if C code is crap just because of C, why C++ code isn't?
 
uh
 
Can someone tell me why this program prints A() B() instead of A() B() B(const B&)? I compiled it with optimisations off in VS
 
RAII? exceptions? templates?
@SethCarnegie RVO
 
@DeadMG yeah, I had optimisations off though
 
11:16 PM
that doesn't mean that the compiler doesn't perform RVO
GCC performs it even in Debug mode, IIRC
 
I don't use them now, nor RAII, nor exceptions
 
@Abyx Then you are effectively writing C code, and it is suck.
 
What are the rules/where can I read the rules about how the compiler decides which copy constructor/move constructor/assignment operator to call?
 
@SethCarnegie Copy ellision, technically, can occur any time you return by value. The exact conditions are implementation-dependent
 
well it looks like a C code, but I can't do anything with it
 
11:19 PM
the hierarchy is something like ellision -> move constructor -> copy constructor
@Abyx Probably because it's a C code.
 
@DeadMG ah that helps, thanks
 
there is a bug in VS, btw, with ellision
 
2010?
 
yes
 
What is it/where can I read about it
 
11:20 PM
sometimes the compiler will try to ellide a copy constructor even when it's a move-only type
 
and error because there is no copy constructor, even though it was a move-only context.
don't recall if it was fixed
 
I want magic tool which will turn C code to C++ code. Renaming .c to .cpp doesn't help.
 
doesn't exist
 
What is a situation where, if no move constructor is found, the copy constructor is called? (Tried returning by value but the copy is elided)
 
11:24 PM
so, I have C code, and refactor it to another C code.
 
quiet day today... both for chat and the site itself...
 
@Mysticial sure is
 
@SethCarnegie That is it if copy ellision cannot be performed.
 
@SethCarnegie I've only found one C/C++ person who's capped... lol
 
@DeadMG is there a way to make copy ellision unable to be performed
 
11:27 PM
no idea, the compiler docs might tell you
why would you ever want to?
 
@Mysticial sry let me make some noise. Only for a few minutes
 
try inserting into a std::vector, for example
 
@Abyx There aren't too many things in C that aren't in C++. Can't you just make those changes directly? There's only a few subtle things like sizeof('d') that could fail quietly.
 
@DeadMG I'm trying to figure out the rules for how the compiler picks a copy ctor, move ctor, and assignment op. because I don't know where to read them
 
@Mysticial it's about code design. actually I have C++ code, but it looks as C code
 
11:29 PM
if lvalue, then copy constructor
if rvalue, then move constructor if exists, else copy constructor
if ellision available, use that instead
 
@Abyx lol, then you're on your own. :)
 
the rules for constructors are no different to those for any other overloadable function, except for ellision
 
@DeadMG no, I mean with inheritance, sorry
 
why would inheritance make a difference?
 
@DeadMG for instance, if B derives from A and B has no move constructor defined, does A's move constructor get called? What about for copy constructors and assignment operators?
 
11:35 PM
if B has no move constructor, then there is no place that A's move constructor can get called
which is exactly the same as for copy constructors
and assignment operator
 
Then why does inheriting from a class with a private copy constructor make the class non copyable
 
by default, anyway- you may still call them internally, obviously
that's completely different to your example
that's B derives from A and A has no copy constructor, not B has no copy constructor
 
No, it's indirectly the same
 
no, it's completely different
 
11:37 PM
B cannot call A's copy constructor in it's copy constructor, if A's is private
 
If B has no copy constructor explicitly defined, it makes a difference whether or not A's copy constructor is attempted to be called
 
therefore, B's default will fail
 
So then B's default calls A's?
 
but if A has a copy constructor and B does not, then the implicit one will be fine
 
@DeadMG You can't spell "braiinsss" without "RAII"!
 
11:38 PM
yes, of course it does
A's default won't call B's, so it doesn't matter to A at all whether or not B does or doesn't have a copy constructor
but the reverse is not tru
 
Yeah, I meant when you're working with instances of B
I think that solves my misunderstanding though
 
if B is noncopyable, it's noncopyable and the user doesn't care why
however, in one case A is copyable and in the other it isn't
 
@DeadMG so the only way the "inherit-from-a-noncopyable" thing will work is if the derived class doesn't have an explicitly written copy constructor
 
yes, you could override it with your own copy constructor
however, in general, there is no way to implement such a thing
 
What do you mean?
 
11:43 PM
well, logically, a copy of the derived class should copy all the state of the base class
but if the base class is noncopyable then you can't
 
That is AWESOME. Make the frog look kinda cute.

Until... it bites :)
 
@DeadMG oh I see what you mean
 

« first day (455 days earlier)      last day (4498 days later) »