« first day (38 days earlier)      last day (4913 days later) » 

12:28 AM
@tina when @FredOverflow wrote "@Alf and @tina, get a room you two :-)" i think he meant that it would better for Very Long one-on-one discussions to be held elsewhere, in general.
2
:)
ok, i created a new room for that but i think discussing your code is of interest to most here (please correct me if i'm wrong! <g>)
original raw code:
char SPI_SLI (char* p1, char* l2)
{
    point* pl2 = (point*)(l2+InfoSize);

    if(pl2[0]==pl2[(int)(*(InfoType*)l2)-1] && pl2[0]==(*(point*)p1))
        return '0';

    int i=0;
    if( *(InfoType*)l2 < 2 ) return 'F';
    for(i=1; i<(*(InfoType*)l2)-1; i++)
    {
        if (SPI_SPI(*(point*)p1, pl2[i]) == '0') return '0';
        if(m_GB.BetweenI(pl2[i-1], pl2[i], *(point*)p1, SPATIAL_EPSILON)) return '0';
    }
    if(m_GB.BetweenI(pl2[i-1], pl2[i], *(point*)p1, SPATIAL_EPSILON)) return '0';
so far sanitized code:
typedef double InfoType;

struct LineString
{
    InfoType    info;
    point       points[1];
};

char my_spi_sli( point& p1, LineString& lineString )
{
    point* pl2 = lineString.points;

    if( pl2[0] == pl2[lineString.info - 1] && pl2[0] == p1 )
        return '0';

    // More quivalent code here.
}

char SPI_SLI (char* p1, char* l2)
{
    return my_spi_sli(
        *reinterpret_cast< point* >( p1 ),
        *reinterpret_cast< LineString* >( l2 )
        );
}
btw., i think you was right about the pl2[lineString.info - 1] just accessing the last point in the array. problem is there's no way to know that (without the original definition of LineString). but it's a good assumption
no. you can say this->Disjoint() or you can say (*this).Disjoint(). because this is a pointer, due to historical reasons
effectively each non-static member function has a "hidden" argument, the this pointer
in some other languages, notably Python, that argument is explicitly present
in C++ it's sort of hidden that the this pointer is passed as argument. that helps, because when it's automated by the compiler the programmer can't screw up
(sorry for language there! :-) )
i think you mean, "when is a static member function practically useful?"
"make its difference prectivally" means?
right
if i understand what you're saying, that's precisely the point of a static member function, that it doesn't have a hidden this argument and so that it can be called without an object (it can also be called using ordinary member function call notation, but no this pointer is actually passed then)
for example, std::numeric_limits<double>::max() is a static member function
it makes no sense to create a std::numeric_limits<double> instance (at least when you know about typedef to introduce a shorter more readable name)
i'm not sure what you were trying to write there
uhm, try it out with a compiler
Consider the type InfoAboutDouble, defined as follows:
typedef std::numeric_limits<double> InfoAboutDouble
Now you can (but shouldn't, really) say
InfoAboutDouble info;
cout << "max double value is " << info.max() << endl;
There is no need for the instance that I called info
No pointer to is passed to max(), because max() is a static member function.
It's static because it doesn't need an object: it knows the max double value
So you just call it like
cout << "max double value is " << InfoAboutDouble::max() << endl;
well you can, but it's a design decision.
Concerning your analysis, the next statement to cleaned up is
int i=0;
if( *(InfoType*)l2 < 2 ) return 'F';
What do you think this does?
yes
yes. it has determined that the line string has just 1 point (or is empty)
So I tentatively submit the hypothesis that what I called info is just the lenght, the number of elements in the points array, i.e.
struct LineString
{
    InfoType    length;
    point       points[1];
};
Then, cleaning up that if statement, we now have:
char my_spi_sli( point& p1, LineString& lineString )
{
    point* pl2 = lineString.points;

    if( pl2[0] == pl2[lineString.length - 1] && pl2[0] == p1 )
        return '0';

    if( lineString.length < 2 ) return 'F';

    // More quivalent code here.
}
ok?
:)
Next statement to be cleaned up is that for loop where you struggled with "condition" (if I recall correctly):
    for(i=1; i<(*(InfoType*)l2)-1; i++)
    {
        if (SPI_SPI(*(point*)p1, pl2[i]) == '0') return '0';
        if(m_GB.BetweenI(pl2[i-1], pl2[i], *(point*)p1, SPATIAL_EPSILON)) return '0';
    }
Now, the continuation condition in the for loop head is just almost the same as the thing we dealt with above.
So, it goes like this, dealing only with the for loop's head:
char my_spi_sli( point& p1, LineString& lineString )
{
    point* pl2 = lineString.points;

    if( pl2[0] == pl2[lineString.length - 1] && pl2[0] == p1 )
        return '0';

    if( lineString.length < 2 ) return 'F';

    for( int i=1; i < lineString.length - 1; i++ )
    {
        //if (SPI_SPI(*(point*)p1, pl2[i]) == '0') return '0';
        //if(m_GB.BetweenI(pl2[i-1], pl2[i], *(point*)p1, SPATIAL_EPSILON)) return '0';
    }

    // More quivalent code here.
}
ok?
Explaining that: it checks the second, third and so on points in the line string's point array, but -- i don't know why -- not the last point
Or, I do know why it doesn't check the last point, because the last point is identical to the first (that's already established). Sorry, foggy brain!
Or, very sorry, that's not actually established, it's just an assumption. Argh.
Do you know why it doesn't check the last point?
 
1:47 AM
Hi, I don't need to put the declaration of a virtual base class' function in the Derived.h, do I? Only the implementation in Derived.cpp, right?
 
@problemofficer You need to declare it in Derived.
 
is this mandatory?
 
@problemofficer if you're not implementing it, then you don't need to declare it
 
uh I see
Pretty logical. I guess I am simply too tired.
 
1:56 AM
Could it be that if I leave out the declaration of a virtual function in Derived.h the implementation in Derived.cpp will be ignored?
 
@problemofficer just try it... ;-) i think you'll get a compilation error
 
Because I commented out a declaration of a virtual function in working code and the compiler didn't complain
 
@tina that gr8
 
2:13 AM
but it's okay to chat here. just not so much UML stuff... ;-)
 
Great Mr. Alf: Are you sure this is actually true?
 
@JamesMcNellis You can test it with value = short(0xFFFF), which simulates 16-bit int (on most platforms).
 
Right, but if an int is only 16 bits, 0xffff is not an int, it's an unsigned int.
 
@JamesMcNellis Dang, you're right. It's the least type that can contain it. So I was wrong not to downvote!
What should I do?
 
I am answering.
 
2:23 AM
@JamesMcNellis yeah, saw that, and added appropriate (I think) comment. ok?
 
Sure. I meant I was posting an answer too. I posted the comment, then decided I had more than 600 characters to say.
 
@JamesMcNellis +1
How does one add a horizontal rule line, like HTML <hr>, in a comment?
 
2:42 AM
In an answer or question, just use a bunch of ------------'s; it'll show up eventually.
I think you need three or four. I usually put in 20 or so for good measure ;-D
 
3:15 AM
@problemofficer Both g++ and msvc emit proper diagnostics, e.g. msvc "error C2509: 'foo' : member function not declared in 'Derived'"
 
 
9 hours later…
12:04 PM
how come ("http://chat.stackoverflow.com/")[chat.stackoverflow.com/] only shows the rooms i'm currently in, not a list of all rooms as it used to?
 
user69820
i think the default tab is favourite
 
@AlfPSteinbach because i'd inadvertently clicked on the mode toolbar thingy
 
 
4 hours later…
4:02 PM
hi All
 
Sam
Hi all ... I am curious about something ... when companies charge for API access, what factors do you think they consider to determine the price of each API calls?
 
4:45 PM
@JohnDibling Why did you have to post that here?
Now you've made me post in that thread.
0
A: C# versus C++ performance

James McNellisThis may be a little off-topic, and like John I'm sure this won't be well-taken by some people, but... In well-written C++, resource lifetimes are managed deterministically, uniformly, and automatically. In most languages with garbage collection (C# and Java in particular), resource lifetimes a...

 
@James: Just trying to drag a few more down with me :)
 
I don't think my rant is on-topic.
I'm at 64 upvotes for the day, so I'm not too worried about the inevitable downvotes :-P
 
SBRM sounds more like a weapon of mass destruction, and RAII sounds ... i dunno ... not as good :)
+1 from me @James
 
No, SBRM is like a sniper rifle; it deletes just what needs to be deleted. Garbage collection is a Weapon of Mass Deletion. It rounds up poor helpless objects and nukes them all at once.
 
Good analogy
We should figure out some way to change the acronym for SBRM/RAII to CAL50
 
4:54 PM
Hmm, what to do all day now that I can't go to work...
 
5:17 PM
Ha ha. No downvotes for you @JohnDibling
 
5:28 PM
@James suprising really
 
 
1 hour later…
6:38 PM
Do we have a "C declarator syntax" badge? ;)
0
A: Initialization of 2D array with dynamic number of rows and fixed number of columns. C++

FredOverflow Is it possible to do it in such a way? Yes: double (*myArray)[numC] = new double[numR][numC]; // ... delete[] myArray; This may look a little unusual, but 5.3.4 §5 clearly states: the type of new int[i][10] is int (*)[10] Note that many programmers are not familiar with C declarator...

 
6:50 PM
@Fred: Wouldn't that just be [C]?
 
sbi
7:33 PM
@FredOverflow Just add a c-declarator-syntax tag to it, and if this succeeds, if you manage to answer more questions in that tag, and once you have earned a considerable amount of rep on that tag, you'll get the badge. This might not happen before next week, though.
 
7:54 PM
I flagged this
-3
A: How to protect your software from being disabled

AthariThe best approach is to flood every single place from where an application can be started with your "hidden" application. Even if your users can find some places, they will miss others. You need to restore all places regularly (every five minutes, for example, to not give users enough time to cle...

IMO no legitimate application would take these steps.
 
@sbi lol @ next week
 
@James: Well, I finally got my first downvote on that one. :)
 
8:42 PM
lol what's up?
 
I'm stuck at home... too much ice to go to work!
 
:/
make it soft, make it microsoft :)
we've not yet had ice on streets. but i guess it will come all the way over us like last year too :/
 
8:58 PM
Last night was the first time in about seven years I'd had to drive in the snow. I'm glad it doesn't usually snow that much here.
 
sbi
9:15 PM
 
it has always amazed me how much pacific-northweterners SUCK at driving in snow & ice
i mean seriously, why would they think locking the brakes will actually do anything?
except make you lose control of the vehicle, that is.
come to chicago. we'll teach you real quick
 
How do you like my answer?
0
A: Does std::list::remove method call destructor of each removed element?

FredOverflowYes, removing a Foo* from a container destroys the Foo*, but it will not release the Foo. Destroying a raw pointer is always a no-op. It cannot be any other way! Let me give you several reasons why. Storage class Deleting a pointer only makes sense if the pointee was actually allocated dynamica...

 
sbi
@FredOverflow <fx> clock slowly ticking away in the ensuing silence`</fx>`
(I have up-voted it, BTW.)
 
9:31 PM
@sbi Thank you, I wanted to say these things about pointers for a long time, and now was the perfect opportunity to get it out of my system :)
I think we should make the question a FAQ, btw.
 
@sbi Yeah; I didn't have anything that bad on my commute; I only ended up almost in a ditch once.
@JohnDibling I learned to drive in Minneapolis. Of course, when I lived there, I had a front-wheel drive car with snow tires. Now I have a rear-wheel drive car with performance tires...
 
sbi
9:47 PM
@JamesMcNellis I take it that their name doesn't refer to their ice performance? :)
 
Ha ha. No. It means I can go really fast and have good handling when the ground is dry. They're pretty much useless here in Seattle.
 
sbi
@JamesMcNellis "when the ground is dry", haha!
"Welcome to the Seattle Rain Festival. Jan 1st - Dec 31st"
 
Pretty much!
 
Why are people suggesting the erase-remove idiom for std::list? Really bad idea imho.
3
Q: Can I remove elements from std::list, when I'm iterating on it?

miksayerHello! Can I remove elements from std::list, when I'm iterating on it? For example so: std::list<int> lst; //.... for (std::list<int> itr = lst.begin(); itr != lst.end(); itr++) { if (*itr > 10) lst.remove(*itr); } ? And why?

> FredOverflow: The erase-remove idiom is really a bad idea on lists. It slows removal of a single element down from O(1) to O(n). Don't do that.
Does anyone agree with me?
 
That makes sense, though I've never really used list
 
9:56 PM
@JamesMcNellis But you do own Effective STL right? ;)
 
Kind of; it's on Safari
 
@JamesMcNellis Let's hope it doesn't get eaten by lions or stomped on by elephants.
2
 
Ha ha ha
 
sbi
Good night everybody!
 
Goodnight
 
10:09 PM
@Fred: You're technically correct, but my point is who cares
if you're choosing one method over another simply because it runs faster, youre microptimizing
 
If nobody cares, why not choose the simple alternative? list.remove_if(functor) is a lot simpler than list.erase(std::remove_if(list.begin(), list.end(), functor), list.end());, right?
Also, erase-remove calls lots of unncecessary assignment operators
With complex types such as string this leads to unnecessary heap activity
The whole point of choosing list is fast deletion in the middle.
Again, complexity theory is the complete opposite of micro-optimization. It is macro-optimization. Choosing the right data structures and algorithms is the way to make your programs run a thousand times faster.
With very large data sets, this can mean the difference between a few seconds and billions of years.
It doesn't make any sense whatsoever to choose C++ and not care about algorithmic complexity.
</rant>
 
I agree.
 
Why do we use binary search instead of linear search? Why do we use quicksort instead of bubble sort?
 
But "choosing the right data structures" means "don't use std::lust" in most cases.
 
Any interpreted BASIC version of quicksort running on my C64 will outperform a C++ version of bubble sort on the most modern multicore machine, given large enough data sets.
@JamesMcNellis Is there really a standardized lust in C++? :)
2
 
10:21 PM
Ha. Oops.
 
@JamesMcNellis I wonder what std::lust::begin() means, then... :)
 
@Fred: drama, drama :)
 
@JohnDibling Dude I'm s3ri0u5, Big-O FTW!!!
 
speaking of lust? lolo
 
@JamesMcNellis Another great STL component I just found out about is std::victor. It's pure win!
 
10:28 PM
What's your vector, victor?
 
@JamesMcNellis That's "airplane", right? In Germany, it's called "Die unglaubliche Reise in einem verrückten Flugzeug".
Loosely translated: "The incredible journey in a crazy airplane"
 
lol really?
 
Ha ha ha. Google translates it as "The Airplane Airplane."
 
Die unglaubliche Reise in einem verrückten Flugzeug ist eine amerikanische Komödie aus dem Jahr 1980. Regie führte Jim Abrahams zusammen mit David Zucker und Jerry Zucker, die auch das Drehbuch schrieben und als Filmemacher-Trio ZAZ mit diesem Film ihre Karriere starteten. Der Film gilt als Durchbruch für Schauspieler Leslie Nielsen, der davor bereits seit mehr als zwei Jahrzehnten in zumeist ernsten Rollen in Filmen zu sehen war. Die unglaubliche Reise in einem verrückten Flugzeug persifliert bekannte Flugzeug-Katastrophen-Filme der 1970er Jahre wie Airport und Airport 1975. Grundlage f...
 
(And, yes, that's from Airplane)
 
10:30 PM
Deutscher Titel: *Die unglaubliche Reise in einem verrückten Flugzeug*
Originaltitel: *Airplane!*
 
@JohannesSchaublitb know that movie? :)
 
If you wanna help this guy understand, please join the comment thread:
1
A: template constant type conversion operator not working under linux (gcc)

Johannes Schaub - litbAccording to the C++03 Standard, that code is ill-formed because template argument deduction will not be able to deduce X& or X const& against const double. C++03 missed to state that the reference is stripped off from the return type of the conversion function prior to deduction, so yo...

 
@JohannesSchaublitb I'm not competent enough in this crazy template world :)
@JohannesSchaublitb I'll just vote you up in fear :)
 
seems like my didactic powers are too poor to answer this guy's comment question :)
@FredOverflow ohh i'm thanksful!
lol
 
10:34 PM
@JohannesSchaublitb Didactic powers... we should build an army of C++ superheroes!
 
@JohannesSchaublitb How's your thesis going?
 
i'm starting tomorrow
last day in company xD
 
Ha ha ha
Tomorrow is always a good day to start something.
 
10:40 PM
"Tomorrow" is a song by Australian alternative rock band Silverchair and was their breakthrough single from their debut album Frogstomp, which was released in 1994 in their home country and 1995 in the US. The song reached number one on both the Billboard Modern Rock Tracks and the Album Rock Tracks charts in the United States, and made #28 on the Billboard Hot 100 Airplay chart. In Australia, the song reached the top of the Australian singles chart. In the UK, the song made #59 on the UK Singles Chart in September 1995. Silverchair's lead singer Daniel Johns said this about the song in ...
 
i thought i would not look into SO until i've finished it. maybe i should really do that?
 
anyone remember that song? :)
 
so tomorrow i will say goodbye to you folks and see you next month some time haha
 
@JohannesSchaublitb nooooo
 
10:40 PM
Who will answer the template questions? :(
 
James will answer them
i will let him get his silver badge xD
 
Yes, I will. Then in a month Johannes will come back and I'll have a comment on 1/4 of them explaining how what I said was almost correct but due to a defect or inconsistency in the standard it's not quite right :-D
 
@JohannesSchaublitb Hope you don't get withdrawal symptoms
@JamesMcNellis LOL yeah
 
I'm glad I didn't discover SO until just before I finished my MS.
 
10:43 PM
i will let all of them alone =)
 
No, I want to know when I am wrong.
 
ohh
i was kidding. i couldn't let my comments off of them :)
 
Isn't that also an FAQ?
1
Q: ++i or i++ in for loops ??

ismail marmoushhi I was wondering in a normal for loop why eclipse and some other people code writing ++i is there a reason for this.

 
Maybe we can get GMan to start contributing again. He can answer template questions.
 
i like his about page xD
 
10:49 PM
I liked it better before he censored it :-P
 
@JamesMcNellis You mean he used to spell out "f#$%in"? :)
 
Yeah. The first time I saw it I actually LOLed.
 
11:16 PM
@James weird, that example about the duplicate declarations :)
 
See, I can't post anything without missing something :-P
 
i'm just trolling around with weird issue reports as usual :)
 
It's good that we have someone that knows enough to do that.
 
@JohnDibling Well, it took six hours but now I have a downvote on that question too
 
11:30 PM
omg is implementing one's own IDisposable class really that horrible? Never knew that.
 
11:43 PM
@James: LOL
damned script kiddies!
 
I need snow days more often. I finished out the day at +100 on Stack Overflow LOL. A new personal best.
 
@JamesMcNellis congrats
 
That's what I get for using unicorns in an answer to a poorly worded question.
 
I have +103, but with 5 new answers today, that's next to nothing :-/
 
I meant +100 votes. Thanks to the rep cap though, I only got 240 rep today.
 
11:48 PM
@JamesMcNellis Oh wow! I only got 5 (on it) :-)
 
@James: Just saw your profile. You're a MS employee using an Intel compiler? Don't the shoot on sight for that? :)
+45 votes for me
 
@JohnDibling I've only been at Microsoft since September. Prior to that, I worked on a large, cross-platform C++ project. We were in the process of evaluating Intel C++ when I left.
 
@James: Speaking of working for microsoft...
 
Uh oh.
 
a number of years ago, I came up with this brilliant idea about how to do something in COM. Dont remember what it was, but i thought it was quite original at the time. I was writing a few articles for dr dobbs at the time, so i started writing an article about it
(nothing bad, i promise)
 
11:54 PM
Ha ha
Cool
 
I told a co-worker about it, and he thought it was cool, too.
couple weeks go by as i write my article. my co-worker took a week's vacation very suddenly
 
@JohnDibling stole your idea?
 
when he gets back i ask him what was up. he said, "oh well i told a recruiter your COM idea, and it secured me an interview. they flew me out fora few days"
but i had the last laugh. he didnt get the job :)
 
Ha ha ha
What happened to the article?
I didn't know you were a published author! :-)
 
oh, i chucked it. if i remember correctly, there was something fundamentally flawed with my idea, which didnt become apparent to me until i got deep in to implementing it
 

« first day (38 days earlier)      last day (4913 days later) »