« first day (250 days earlier)      last day (4691 days later) » 

1:05 PM
man, I can't get VS to compile my code, because it insists I have an abstract member when I don't
:(
I even copied and pasted the declaration from the base class and just cut virtual and =0 from it
 
@CatPlusPlus I think that goes to the one on xml
 
@DeadMG did you give it a body?
also you can leave the virtual on
 
I know I can, but I like to leave it off
 
are you sure the classes it is complaining about are the ones you think they are?
 
no, I haven't given it a body yet
it's very explicit
 
1:17 PM
if you haven't given it a body it's just a forward decl. - not sure if that is enough to stop it from be abstract
I'd give it a body
 
I didn't give any of the other abstract functions bodies and they're all perfectly happy
I gave it a quick return nullptr; body and no change
 
obviously not every-body's happy ;-)
any templates involved?
is the inheritence direct?
 
no templates, direct inheritance
 
have you checked out of any hotel rooms lately?
 
no :P
man, SO hates the VS error
 
1:21 PM
any macros with the same name as the method?
 
no
 
then divide and conquer
 
I don't have any macros, actually, apart from those specified
 
(ie, isolate in a copy project and hack it down to the minimum thing that has the issue)
 
in the Windows headers
#define CreateFont CreateFontW
fuck you, Microsoft
 
1:23 PM
trouble is std::max( yourMacrosCount, windowsMacrosCount) doesn't mean anything and may not even compile ;-)
is your demonstration of affection for MS an indication that that was the issue? or just a random utterance?
 
that was the problem
I moused over the function name and Intellisense reminded me that that specific function is actually #defined
 
aha
cool
glad I could help :-)
 
@DeadMG or CreateFontA if you use Multibyte
 
right
I refactored to not include the Windows headers in that specific place
not something which I can depend on since I'll need Windows-specific code in that class soon
maybe I'll just declare what I need manually
 
#undef CreateFont ?
 
1:28 PM
nah, that doesn't work, because I'll just run into the same problem, over and over again
I remembered that this isn't the first time I've run into the horrific macro leakage
 
can you change the name of the method?
 
well, sure, I could name it MakeFont instead
but I think I'm just going to not include the Windows headers instead
 
*cringe* "method"
 
otherwise, just declare what you need from windows.h manually. That can work if you don't need much
yeah
that's usually my preferred way
I like to keep the windows api on as tight a leash as possible
 
let's see whether my flag-weight increases from 95 to 100 now
because I believe I just did an appropriate flagging on DeadMG's answer haha
 
1:30 PM
honestly
I considered re-phrasing it, but it just doesn't express what I'm feeling
I'll live a flagging or two
 
one can #undef CreateFont but one cannot #undef an extern "C" of CreateRender :(
 
why would I want to #undef the extern "C"?
 
1
Q: Can't override abstract function

DeadMGI've got a base class, and I put an abstract function in it. Now I've inherited from it and declared that function in my derived class. But Visual Studio still won't compile my code and insists that the derived class is abstract. I even copied and pasted the declaration from the base class and ju...

lol
 
the function is exported by name and loaded dynamically with GetProcAddress
 
1:32 PM
at least that is scoped, @Johann (even if to global scope)
 
@Phil no linker-scope though :(
though ... people that get bitten by it will have done evil things themselfs too so I'm not too sad
 
true
@DeadMG - didn't realise you had an SO question on it
 
man
 
3
Q: Strange error for member function declaration

Johannes Schaub - litbBelow is something that did happen to me and I couldn't get what's wrong. My coworker and me screwed our heads around this. It was in a cross-platform library using the cross-platform toolkit wxWidgets on Windows #include <wx/wx.h> class Graph { public: // ... // main1.cpp:4:10: erro...

 
I also flagged it.
 
1:34 PM
my x64 define is gone
 
@TomalakGeretkal i figured you would go for capture-the-flag
 
you haven't lived if you don't get flagged from time to time :P
 
@JohannesSchaublitb :P
@DeadMG fair enough
still, not a good example to set to the newbs.
 
argh
Visual Studio, for Christ's sake
yes, I want to use the same character set in both Debug and Release builds
 
perhaps you should go into carpentry
 
1:36 PM
lol
no thanks
 
let's quickly get it on reddit so it's getting down to -100
it happened to a guy not too long ago :)
 
haha yes OK
don't think I've seen a -6 before
please don't delete it; let's see how far it'll go
 
you know what I hate?
 
25
Q: Top user's answer victim of Reddit mob behavior

Rafe KettlerI don't know Hans Passant, but he's the 5th highest rep user on SO, and I'm sure that's no fluke. He clearly is very active and knows what he's talking about. His answer to the question at vb.net - Interrupt form loop and end form did not satisfy the OP. He asked for the answer to be accepted an...

 
1:40 PM
how you can't get a preprocessor definition based on sizeof()
I really wanted something like #if sizeof(void*) == 8 #define X64 #endif
don't want to depend on Visual Studio for my platform defines
 
yeah that sucks :(
with my static_if that works on gcc one can do it :)
in some limited fashion
 
lol
I wonder if I can get a badge for accepting an answer with such a low score?
 
haha -71
poor Hans; then again, he deserved it
@DeadMG even if one existed, it wouldn't work for a self-answer;p
 
it gives an error message when trying to browse to that page:
We apologize for any inconvenience, but an unexpected error occurred while you were browsing our site.

It’s not you, it’s us. This is our fault.

Detailed information about this error has automatically been recorded and we have been notified.
 
@Default If you ever say "it doesn't work" again, I am going to find you and I am going to kill you. Slowly.
 
1:48 PM
yeah.. sry..
 
@JohannesSchaublitb Link's broken ;(
 
not my fault
 
I tried searching for it but it actually gives the same error
alert the authorities!
 
I would delete my comment now you've changed yours, but it's too good :D
 
1:50 PM
Spolsky probably deleted it
You know what he gets like
oh:
 
ppl will be able to look into the message's history to know what youre referring to
 
same link; it works now
 
i like this pic
 
lol
awww, my answer got deleted by Bill
 
So, i've got a question about static libraries that you may be able to help me with.
 
1:55 PM
maybe
 
... Well, ok, I've got a thought i haven't been able to put into a question
 
better :)
this is the place
 
I'm including a static library in my program
But, unless i reference it from my program it's not available...
See, i'm not explaining this very well
I'm using JNI which requires a native library to have a method signature which conforms to a certain type - But when I include a static library which contains this method signature it isn't picked up unless my native code calls the static library from which it is included....
Why is that?
 
Unused symbols are usually removed, because, well, they're unused.
 
compiler optimizations
 
1:58 PM
When you say "Symbol"
 
^
unused symbols are not "usually" removed
 
only if you say -funit-at-a-time, which is the default starting with -O1 I believe (and if the symbol is static)
 
in GCC you usually have to compile with -ffunction-sections -fdata-sections and link with --gc-sections for the optimiser to have a good shot at it.
10
Q: C/C++: Do unused functions get optimized out?

PaulA fairly simple question... Compilers these day tend to do a significant amount of optimizations. Do they also remove unused functions from the final output?

 
Thank you - will be back once i'm done assimilating.
 
oh recent GCC's even have it at -O0 it seems
 
2:00 PM
;)
 
I don't know, I don't use GCC. MSVC's linker has /OPT:REF for that.
 
i remember gcc4.3 at work doesn't do it
 
And it's usually off for debug, and on for release builds.
 
yes, MSVC (the Visual Studio compiler/linker) can do this if you compile with /Gy and link with /OPT:REF.
"if" being the operative word
 
not sure why -ffunction-sections would have an effect on this?
ah perhaps that makes the linker be able to remove individual functions, as opposed to whole TUs only
 
2:03 PM
it makes linker stripping easier
 
oh
hey for all those interested
0
Q: Please make entries in "responses" link to the respones directly

Johannes Schaub - litbWhen following a link in the "activity" page, you are directed to the entry directly. That is, if the activity was a comment, you directly jump to the comment. But in the "responses" page, if you follow an entry, you merely jump to the answer or question that the response was on, and not to the...

 
Lol, people on proggit defending SOAP.
 
is still confused by linking table and optimisation but that sok
 
2:25 PM
5
Q: How to terminate worker thread properly in an injected DLL?

OmerI'm injecting a DLL into some process, the DLL has a worker thread that is running a message loop. I'd like to quit the thread properly i.e. post a quit message (PostThreadMessage) and wait for it (WaitForSingleObject). Where can i wait for this thread to close? I can't do it on DLL_PROCESS...

 
2:46 PM
@Tomalak the take-to-the-comment only works in a few cases for me
 
@JohannesSchaublitb odd
 
@JohannesSchaublitb I'm suspicious that it's secretly laziness. Not all comments show, and you have to expand to show all. If you link to a comment that's hidden, the page would have to know how to expand. I might be wrong, but that's extra work.
 
it also doesn't always take you to the comment even if that comment still is shown without expanding
 
@JohannesSchaublitb Still possibly laziness. It's broke and Jeff doesn't feel like fixing it, because he doesn't value linking to comments.
I have a question for anyone familiar with MFC and STL containers. Is std::vector more efficient than CArray?
I searched around the forums around the net, and the response I get is.... "Yes". That has me feeling people are just spouting without really knowing an answer.
 
My response would be "don't care".
Not "I don't care", but an instruction not to care.
 
2:52 PM
I'm not following?
 
Why not?
 
This is important because we're having efficiency issues in a list that's trying to handle 60,000 rows of data.
 
I would expect no more than the tiniest of differences if anything, well below the margin of micro-optimisation. But that's just a guess.
And your profiler has told you that CArray is at fault?
Are you using it incorrectly?
Is it an inappropriate data type for the work you're doing?
 
@Xaade the question is (almost) moot. You'd have to specify an implementation of std::vector
 
Trying to find "a more efficient implementation" of an array as if that's some sort of silver bullet is the wrong approach.
 
2:54 PM
Well, we are using a secondary index (which we'll change to access using a map to a pointers, instead of sequential search)
 
post this question on SO and I'll say all that in an answer, and get heavily upvoted for it. (and then probably flagged as "not an answer".)
 
of course the std has some constraints on what the implementation can be which can limit it, but I don't think there's anything that drastic in the case of vector
 
Ok
That's the answer I need
There's too little difference to matter
 
yeah - the interface differences are much more relevant
 
Oh, I've already noted several causes.... I just want to eliminate every cause.... that's why I asked.
Doing a lookup for a row right after an add is one big cause.
Increases add time by a factor of 4 for small lists, and since that's an exponential function, I can hardly imagine what the slowdown is for 60,000 items.
I'd really like to ask the original coder the reason for that!
Row* pcRow = new Row(...); List.AddRow(pcRow); for(int i....) if (List(i)->key == nKey) { pcRow = List(i); }
I mean... you already have pcRow, why do you do a lookup for the secondary key after the add....
 
sbi
3:15 PM
Oh, Joel has re-opened stackoverflow.com/questions/6441218/…, and instead of merging it answers in one of those it is a dupe of, merged those into this one... :(
 
fail
-1
Q: Using an object method as a function callback

6.45.VapuruI am using a C library which has callback functions such as: int DownloadStream(LPCTSTR host,DWORD channelNumber,NewImage pNewImage); typedef int (*NewImage)(BYTE *pData, int nLen,void *returnHandle); In C i can make call like this: int CallDownloadStream(LPCTSTR host,DWORD channelNumber)...

four answers, three of them quite wrong
amazing how something so simple can be failed so hard
 
Xeo
3:33 PM
421
A: How can I ensure that a division of integers is always rounded up?

Eric LippertGetting integer arithmetic correct is hard. As has been demonstrated amply thus far, the moment you try to do a "clever" trick, odds are good that you've made a mistake. And when a flaw is found, changing the code to fix the flaw without considering whether the fix breaks something else is not a...

That will show you how.
 
3:46 PM
EricLippertOverflow
 
EricLipsOverflow
 
hey gents, can anyone help me with an 'undefined reference'?

http://pastebin.com/bBrFBG7D

I'm getting an undefined reference for no reason that I can tell.
full disclosure, I'm integrating code from VS2010 into Qt, compiling with mingw gcc, and also I'm coming back to c++ from c#
so I'm rusty as all hell
err, not MingW gcc... that doesn't exist. MingW 4.4
 
MinGW gcc doesn't exist?
Fuck....
what the hell have I been using all these years, then?
 
I meant as a Qt compiler target :P
 
@Eric_H: You didn't tell us what undefined reference error, but it's pretty clear. Presumably you're not sure what's going on because you didn't use those functions. In fact, you must implement all virtual functions, whether you use them or not.
 
3:59 PM
but no, obviously you're just in a really long dream, and there isn't a MingW gcc
oh it was to the constructor
 
Also, next time, produce a testcase that reproduces the issue when run in codepad or ideone.
@Eric_H OK. Where did you define the constructor?
 
in "SHD_Model.h", I defined an empty constructor
 
You left that out of the code you pasted.
Produce a testcase please.
 
k, will do
sorry for noobing it up
 
Or, if you think that you included the definition in your paste, tell me which line. And I'll tell you how wrong you are. :)
 
4:04 PM
I have no illusions that in moving to the hand-holding, coder-spoiling world of interpreted languages, I've lost my ability to code native apps in c++
same undefined reference. so, I'm thinking it's my lack of definition, as I'm simply declaring the constructor?
wow the grammar in that sentence was bad... basically, I mean that I've lost the ability to write c++. It's been since college, really
 
Yes, if you declare, but not define, and then use, you get undefined reference from the linker.
 
well, it's looking like it's a lack of virtual function implementation. Tbh, that's my biggest problem, I am having trouble figuring out the real nuts and bolts of inheritance as it pertains to overriding functions.
at least, that's what I assume the 'vtable' part of the undefined reference implies. When I add the curly braces to the constructor for HoldemHandProcessor, I then get a 'vtable' undefined reference for both HHP and its superclass
 
Is BaseHandProcessor meant to be an interface?
 
well, not really, it's the virtual superclass for all HandProcessors. I need to override it for Texas Holdem, Omaha Holdem, all the way to 7CardStud, which is why it's so empty
I'm just trying to enforce OOP on the outsourcing house that is taking this project over from me. The code I'm replacing was O(n^4), in two 4k-line structs. Abhorrent
 
Well hopefully the members are defined then. Me, I'd take a look at the symbols to check what's missing from where but I don't know what's your toolchain.
 
4:15 PM
hi guys. Does any of you know if the non blocking version of getchar() exists? I'm working with C, not C++
 
I'm basically stuck in Qt Creator, but I can take a look at the symbols. I thought that I was supposed to leave virtual methods empty? The superclass doesn't contain any members, at the moment
 
@Eric_H Yea, there's no definition there.
@Eric_H "empty"?
 
No, no, no and no. Declaring something in C++ means "this exists somewhere". If you don't put a definition, you're lying (most of the time).
Are you sure you don't want pure virtual members?
 
that's a distinct possibility
I will research the difference
as a stopgap, I assume that the way to fix this is to give at least empty definitions
 
4:18 PM
and when I override the base methods, I will get the same error unless I provide empty definitions for those as well, correct?
 
Or adding a pure virtual initializer: virtual void member() = 0;, depending on how you're using BaseHandProcessor
This is why I asked whether it was meant to be an interface or not
 
+1 for "whether"
@Eric_H I'm actually slightly surprised that there're not already undefined reference errors for those virtual member functions. You don't invoke them, but you're supposed to define all virtual member functions IIRC.
 
I'm getting them in Qt
the errors, I mean
 
Yea. It could just be a quirk.
 
Nitpick: Qt is a library.
 
4:20 PM
I think I wasn't before because the compiler choked after the lack of constructor definition
@Cat
 
Seems you can get away with it if you use automatic storage 1 2
 
@CatPlusPlus you're correct, I mean in Qt Creator
well, with my two disparate deployment environments, I want the code to be completely clean, so I'll fix that
 
Still, you should define virtual functions.
 
or define them as pure virtual
 
thank you for the help everyone, it's time for my conf call. Is there any system for giving points within chat?
 
4:22 PM
no
 
sigh. well, I do appreciate the help. I'll make a formal question next time
 
We accept candy.
 
not from strangers
 
well, I don't have a van
 
@Eric_H We have a FAQ for that:
30
Q: What is the difference between a definition and a declaration?

MaciekAs title says, the meaning of both eludes me.

 
4:28 PM
wow
you know, I'd make some snide comment about how I know the difference between a declaration and a definition, but the past 20 minutes have proven that I don't
btw, I looked in the newbie hints, but how do I link a question like that?
 
The past couple of years have taught me that I know almost nothing about C++.
2
@Eric_H Just paste the link, it will automatically look nice :)
 
honestly, when I first wrangled this code back to in-house, I was so excited to use c++ again, and learning how to interop with c#, but man... I suck at c++
 
I sometimes feel like I know less than nothing about C++.
 
and c++-cli just... it's not great
 
Especially here.
 
4:31 PM
@CatPlusPlus What is less than nothing? null? void?
 
sqrt(-1) imo
 
@CatPlusPlus Well, at least you know how to bad-mouth C++ ;-)
(Or was that someone else?)
 
@FredOverflow -1, duh.
 
o snap?
 
-1 is less than zero, but zero certainly isn't "nothing".
 
4:33 PM
my favorite is that anything^0 is 1... makes absolutely no sense
 
Actually, it does.
x^(a+b) = x^a * x^b, right?
 
beyond being a mathematical nicety?
right
 
So x^a = x^(a+0) = x^a * x^0 = x^a * 1 = x^a
If x^0 wasn't 1, this wouldn't work.
 
If I quantify my knowledge then nothing gets mapped to zero.
 
I'm going to go out on a limb and say that this came to being because:

"x^a = x^(a+0) = x^a * x^0 = x^a * ??? = x^a", so they added it as a nicety
 
4:35 PM
So less than nothing is -1.
 
to fit the proof
 
there's other mathematical formulas too
 
Also, mathemagicians.
 
x^0 = x^1 * x^-1 = x * 1/x = 1
 
4:36 PM
nice one!
 
1
Q: What is the data type of vptr?

cppcoderAny class having a virtual function would get an extra hidden pointer which would point to the most derived class. What is the type of this vptr?

 
wow
wp sir, wp
 
thank you
I am the sexiest man in the room
 
Yay, 25k!
 
yay, 30... well, I'm off to answer c#/WPF questions. I guess I'd better make myself feel less of an idiot
 
4:38 PM
@FredOverflow: Nice proof!
DeadMG's ain't bad either.
 
I like DeadMG's better.
 
Remember, 1 is the 0 of the geometric world
That is, +0 and -0 is a no-op, and in a similar way /1 and *1 are no-ops
so it makes sense
 
@TomalakGeretkal And 0 is the 1 of the... arithmetic world, I guess?
 
i.e. there are different ways of talking about identity when you go from +/- to *//
Yea, I couldn't find the word >.<
linear, I guess
 
And i doesn't really exist.
 
4:41 PM
I only know it from the difference between "arithmetic middle" and "geometric middle". The former is (a+b)*0.5, the latter (a*b)^0.5.
(Isn't that beautiful? Both formulas use 0.5.)
 
SO is breaking up somewhat.
 
I was thinking about "{linear,geometric} series".
@CatPlusPlus ?
 
@CatPlusPlus I'm sorry for you @Cat. You don't need to deal with depression. Have hope.
 
I keep getting errors.
 
4:42 PM
 
@CatPlusPlus Of course imaginary things exist. Haven't you watched the "Imaginationland" South Park trilogy? ;-)
Is there something "beyond" complex numbers (in the sense that complex numbers are "beyond" real numbers)?
 
@FredOverflow If imaginary things are developed by our brain, they correlate to neurons firing off in distinct orders. If that's true, then they do exist.
 
AFAIK, no. But I only know some basics.
> Oops! Something Bad Happened!
 
But how is an imaginary number any less real than a real number? I have never actually seen a real number in the real world :)
 
And again and again.
 
4:44 PM
@FredOverflow That's be hard to do, because a complex number to an nonnegative exponent is a real number.
 
Aren't all numbers "imaginary"?
 
But 7 8 9.... so 6 is afraid of 7!!!
So they must exist.
 
@FredOverflow discrete quantities, as an abstraction, are not a man-made concept
 
You can't show fear and not exist.
 
@TomalakGeretkal example?
 
4:45 PM
@FredOverflow of course, our representation of that notion is very much man-made. imaginary numbers takes that into the realm of "potential", just like we do when talking about energy. Simple as.
 
@FredOverflow 42
 
@FredOverflow Example of?
 
@Xaade Er, (1 + 1i)^2 is still complex.
 
@TomalakGeretkal "discrete quantities, as an abstraction"
Who made those, if not man?
 
Frogs.
 
4:47 PM
@CatPlusPlus The idea is to enhance the real numbers by adding a number i whose square is −1, so that x = i and x = -i are the two solutions to the x^2 + 1 = 0.
 
Isn't every abstraction man-made?
 
@FredOverflow "There are three apples in the barn." We decide that one apple starts and ends at a certain point on its form, and notice that there are three of them. The count "3" is human; the fact that there are three apples is, of course, not...
And when you take things down further the abstraction goes away entirely. "There are three electrons."
[disclaimer: ignoring sub-atomic physics or we'll be here all day]
 
We're here all day anyway.
 
4:49 PM
Now, we can apply our abstraction both to the physical notion of quantity (which is very natural to us), and to things that we just fucking made up entirely. Like imaginary quantities.
Just because the complex counting system is based on applying our counting ability to a platform of quantityness that doesn't really physically exist, doesn't make it any less sound.
 
@Xaade I know. :P
 
@CatPlusPlus So the recomposition of a legitimate complex number is a real number.
 
Does a complex counting system falling in the woods make any less sound?
 
1 min ago, by Tomalak Geret'kal
Just because the complex counting system is based on applying our counting ability to a platform of quantityness that doesn't really physically exist, doesn't make it any less sound.
I'm sorry.... any mathematical system that doesn't have a representation in the real world, isn't useful.... and may not exist at all.... or even be incorrect.
 
i alone is imaginary unit, x * i is an imaginary number. Complex numbers are a + bi.
 
4:51 PM
:-(
What's up with SO? Anybody else experience this?
 
Or, the more fun way, |z|(cosx + isinx).
 
@FredOverflow Experience my cat getting up to a laptop.... not really.
 
What kind of laptop is that, anyway? Looks part laptop, part cash register or something :)
 
@FredOverflow Well, I've been whining about it for the last 5 minutes or so.
;P
 
I think Jeff talked about that on one of his posts.
 
4:53 PM
@FredOverflow And it has a piece of paper on the "monitor?"
 
The cat in the picture... is that you, @Cat Plus Plus? :)
 
I'm most certainly not working.
 
If so, thanks for fixing our problems :)
 
@FredOverflow He has a pic.... @Cat Plus Plus is white (at least around the head and shoulders), that cat has black ears.... not the same cat.
 
4:54 PM
@Xaade Maybe he went to a hair stylist!
 
@FredOverflow Dyed his fur?
@FredOverflow "problemz"
 
@Xaade I'd die for fur dyed like that!
 
@Xaade imaginary numbers aren't useful?
 
I wonder when the time is ppl refer to the "hotel thread" instead of the "binky video"
 
@Xaade Yes, you did.
 
4:58 PM
@FredOverflow: See blog.stackoverflow.com/2010/06/workin-on-ur-problemz for the laptop details.
 
@JohannesSchaublitb The pointer video?
 
@TomalakGeretkal What do they actually solve.... other than finding solutions that can't be applied in the real world, to problems that shouldn't exist?
 
@Xaade I can't answer that, not being a mathematician.
But it strikes me that your question is probably rather ridiculous.
 
AFAIK, complex numbers are used quite often in engineering.
 
4:59 PM
The only thing I see them solving is the mathematical desire to have a solution to every problem.
 

« first day (250 days earlier)      last day (4691 days later) »