« first day (10 days earlier)      last day (5164 days later) » 

00:00
I was hoping to move the overloading into a different parameter type for each combination.
Hi, is this an open chat on c++?
mainly
Oh nice
mainly
Has anyone used petsc?
00:21
@GMan, @JamesMcNellis: hidden comments?
@Roger: Haha, yeah.
01:10
@RogerPate Well, when I can't reply in a real comment, I do what I can :-)
@Dragory probably DLL mismatch or a duff version. see my answer on SO (stackoverflow.com/questions/4008921/…)
@Dragory also I can zip up the project etc. if it helps.
What's the cleanest way to, with Boost, get the type of a function call?
Oh nm.
@GMan does it notify you when someone edits a deleted post?
@RogerPate I don't think so, but when James edited mine I saw in by my own accord. So maybe I just never noticed.
Edit one and I'll let you know.
/me edits funny things into g_man's deleted posts.
01:25
:S
edited
I know editing deleted posts does bump the question :P
Haha, yeah.
That's a good trick to bump questions onto the front page... answer again, delete your answer, and keep editing it.
Nothing, not even under my revisions tab.
now you get to find which random deleted post of yours I used and what I said!
01:27
looool. it bumped it luckily, let's see...
Haha, "this is a test of the emergency hidden comment system".
Shame it doesn't let me know.
wonder if you can get a feed to your question/answer recent activity
though that wouldn't help here, actually; as it's the other person's question bumped instead of your answer
yeah.
My code isn't compiling, can anyone help?
This is what I have:
`mystring function(asdfdkjgl) { kl l; return +5; 2+ 2; }`
You need to use a shared_ptr.
have you tried jQuery?
01:43
Ah, you mean shared_ptr<jQuery>?
-2
Q: Quick stupid question, pointers and functions

John StudioSo when I pass a const char * to a functiononce, I cannot use it again? It ends up spitting out crap to me? const char *config_file = "file.txt"; function(int x, config_file); cout << "Number" << x; secondfunction(int y, config_file); Do I need to make a pointer to config_file...

I like his description of what his compiler does: "It ends up spitting out crap to me?"
lol.
Compiler errors: Just stupid, useless crap.
@RogerPate I never mentioned it, but in your answer here, that's a helluva include guard you got there.
 
2 hours later…
03:53
good evening, morning or whatever time of day it is
hai
"Oh hai. In teh beginnin Ceiling Cat maded teh skiez An da Urfs, but he did not eated dem." - Genesis 1
04:18
Ceiling cat is watchin you segfault
lol
Good Morning.
04:39
Can anyone help me with this please
http://stackoverflow.com/questions/4020731/assertion-failed-error
4020731
@soldieraman: I don't think that actually has anything to do with C++; most software on Windows relies on the VC runtime libraries, regardless what language it is written in.
it looks similar to the assert dialog
but i thought assert would only run under debug code
assert prints a diagnostic message when expression evaluates to false (0) and calls abort to terminate program execution. No action is taken if expression is true (nonzero). The diagnostic message includes the failed expression and the name of the source file and line number where the assertion failed.
After debugging is complete, assertion checking can be turned off without modifying the source file by defining the identifier NDEBUG. NDEBUG can be defined with a /D command-line option or with a #define directive. If NDEBUG is defined with #define, the directive must appear before Assert.h is included.
assert to abort out of production code?
05:07
@JerryCoffin: Welcome to C++ Chat
@Shiftbit The runtime assert can still be triggered by toher means
anyone using COM (component object model) here?
05:30
Hi James -- thanks.
05:48
Man
It's 2010 and I can'
t find a quick way to communicate over Telnet
Superb.
What are you trying to communicate with?
A server (on a robot, btw)
And what from? What problem do you run into when you just use telnet <robot's IP address>?
Ah sorry
I need to do that through C++
I tried libcurl --- it does not support telnet very well
I think I'll need to use stdin to send info (then I could've just used telnet)
Next stop, Winsock or CreateProcess.
CreateProcess + pipes, i.e.
is there anyone who has played with Euler 3d rotations?
05:58
Yeah -- libcurl is main for dealing with web pages, not telnet. Have you tried (just for example) libtelnet (github.com/elanthis/libtelnet)?
@Jenko: A bit, why?
@Jenko Sure.
I have a question about angle calculation
1
Q: Calculate rotations to look at a 3D point?

JenkoI need to calculate the 2 angles (yaw and pitch) for a 3D object to face an arbitrary 3D point. These rotations are known as "Euler" rotations simply because after the first rotation, (lets say Z, based on the picture below) the Y axis also rotates with the object. This is the code I'm using bu...

its really simple actually
I just need to calculate 2 angles for an object to face towards a point in 3d space
@Jerry: Actually, in all my Googling, I didn't see that. I'll take a look!
@Jenko For orientations, quaternions are really the way to go.
06:00
@JerryCoffin
I've opened a question for this, btw:
0
Q: Communicating over telnet

JacobI can't use Boost ASIO (reasons not related to programming) and I looked around and libcurl looks good. I'm building the binaries at the moment and decided to get some feedback from the community. Any comments regarding libcurl/alternatives? UPDATE: libcurl's not great for telnet. It's 2010! S...

@GMan - okay, now currently here's wot i do:
- calculate a rotation matrix once per object based on 3 angles, X, Y, Z
- use this matrix to transform all points of my 3d object
okay so if you want me to use quaternions I'm going to need code that can calculate a rotation matrix from a quat? .... I tried this before but it does not product wot i call "local rotations"
what* btw
@Gman - compares "local" vs "global" axis rotation
@jenk
@Jacob - if you have some idea about that question of mine .. be very grateful for any help
which I'm trying to figure out!!!
06:04
@Jenko: Do you have a desired normal (i.e. orientation) for the plane?
@Jacob: yeah, I noticed your question earlier, but didn't have a chance to answer at the time, and had forgotten by the time I had a few minutes.
@Jacob: I can calculate a normal based on the direction of the point, yes
@JerryCoffin: libtelnet looks quite good. Thanks!
@Jacob: Sure, no problem.
hi there! not sure if this is the right forum but i have a small question related to VB6 if anybody is willing to answer!
06:10
@jamin - not the VB6 forum!!
better try elsewhere
@Jacob: any ideas?
one sure can't scare the local people with vb6 :))
..enough to make them interested :))
vb6 and office automation .. expecting questions like "how to select a cell in excel? please please need urgent help!!!"
@Jenko You click the cell; duh...
06:16
..programmatically sending mouseClick to Excel
))
Well, first you have to programmatically send the print-screen key so you can get a picture of the window; otherwise how will you know where to click?
@James -- trying to be funny!
You have to take a screenshot of the window, paste it in Word, send the Word document to a computer guy you know which will answer you how
I was too; maybe it's too late for me to be funny. I'll try again tomorrow.
@Jenko In your problem you could first find a quaternion, that makes the rotation between V1 and V2 (vectors) and the decompose that quaternion into heading, pitch and roll.
@Jenko Rotation between is described here gamedev.net/community/forums/topic.asp?topic_id=429507
06:20
and then steer to he;ll
@Jenko And the second part is a bit more tricky, I can give you some code from my math library...
@Jenko: there's another tutorial at: gpwiki.org/index.php/…
oh, so that vector stuff was serious, sorry
;(
i always attempt to handle serious stuff when i'm drunk =\\
hm
@HardCoder1986: Just be careful: xkcd.com/323 (In case you're the last coder on earth who hasn't seen it..)
06:25
A beer, good idea! brb.
unfortunately, i prefer tequila....
and that could sometimes have unwanted consequences)
Bah, go get some.
I can easily imagine BS with a couple of beer cans on his coding desk ;))
I should add, however, that contrary to claim, it was not discovered by MS in the late '80s. I actually experienced it once (though I think the BAC was higher than he gives). A friend of mine and I went to the "Hall Inn", got "comfortable", so to speak, went back and wrote a fairly completely multiplayer game (in Fortran), then went and passed out.
When we came to, there were all these new files neither of us clearly remembered, but the first time we tried it (at least that we could remember clearly) the code ran essentially perfectly!
06:33
Thats the way!
Oh, forgot to mention: that was late '82 or early '83...
Hi what's the meaning of this line:

static const uint64 UnitOne = 100000000ULL;
uint64 mask = (1 << prefix_length) - 1;
sbi
sbi
@JerryCoffin Oh c'mon, now you're just showing off your age. :)
Has one of you guys seen the discussion GMan and I had recently at stackoverflow.com/questions/3997700/…
@sbi: Nice of you to show. :)
@neversaint Which part? You say "this line" and show two. :)
@neversaint Look like there are more lines
06:41
Roger Pate and I were arguing about that a few nights ago
I am wholly in favor of more FAQ-like questions
Or more in-depth, how-to style questions
I am too. @Roger sure isn't, though.
@sbi Raised the idea of a C++-faq tag that was specifically used for FAQ-like questions, that solved a problem in-depth.
I doubt there is a really good answer. On comp.lang.c++, there are a few people who put in quite a bit of time writing answers that point at the FAQ (if memory serves, Neil was among them at one time).
You brought up Neil. :( Need more beer.
sbi
sbi
@JerryCoffin @Jerry: Actually Neil's departure was what got me thinking about this.
Personally, I rarely did/do though; IMO, the C++ FAQ (and most others) tends to generalize too much, and tries to condense answers too much, so it doesn't take into account what are often a pretty wide range of reasonable answers.
06:46
Chatting with Neil would be awesome. Someone would be like "So when I do int i;, what's the value of i?" "You nitwit, you never initialized it. What C++ book taught you that? Maybe read closer next time!"
etcetc
sbi
sbi
@GMan Yeah, I dropped in to point at our discussion. Should go to work instead, though. (It's almost 9am here.)
@sbi: that's not surprising. I should point out, however, that Neil departed comp.lang.c++ a few different times, at least IIRC. For that matter, I've done the same a few times -- when you're more tempted to write a flame than a useful answer, it's time to spend more time doing other things for a while.
sbi
sbi
Grr. I still need to get acquainted with this chat thing.
Neil was actually pretty polite about things. A few of he denizens of comp.lang.c (and even comp.lang.c.moderated) used to be much nastier. Unfortunately (speaking of my age) I can't remember most of their names anymore.
sbi
sbi
Now. Whaddayallthink about that FAQ thing?
(Trying to stay focused here. Did I mention I should go to work?)
06:51
I like the idea a lot. I think it may prove difficult to manage a c++-faq tag, though. We won't know until we try, though.
sbi
sbi
What do you mean "manage" it? (I'm not trying to say there's nothing to do. Just asking for your opinion.)
Keeping the quality up
Making sure that only good, frequently asked questions with great answers are tagged c++-faq
Otherwise, the tag will be as useless as vector or pointers.
I think it's a great idea, though.
Is this something we should ask on meta?
Like "get permission" for?
sbi
sbi
@JamesMcNellis I see. The other idea was using the tag wiki for it. stackoverflow.com/tags/c%2b%2b/info
06:56
How often do we suppose people actually read that?
The big problem I see is that you just about have to write the questions specifically to use as FAQs. Most real questions will ask some subset of the real question, or ask it in a way that you pretty much need to be an expert to realize that 1) it is a FAQ, and 2) there's one answer to roughly 10,000 variations that the people who need ti won't recognize are really the same.
@sbi: Yeah, I was just thinking that too, since that can only be edited by... well, fewer people. We already have a few questions linked from there too, I think.
I could see using the tag wiki if, when asking a question, it says "HEY YOU, PLEASE READ THE TAG INFO BEFORE YOU POST, KTHNX"
But otherwise people will just breeze right over it.
sbi
sbi
Yes, I think this should be discussed on meta before we pull it off.
I also think the question starting this should be asked on SO first, then moved to meta. And I think it should be asked about 10am PST. :)
@JerryCoffin Definitely. But you could also take good candidates and change them to become FAQs.
@JerryCoffin I agree, but a good set of FAQ questions can also help make it easier for those who frequent the C++ tag to point people in the right direction. I know that I have trouble finding duplicates sometimes.
sbi
sbi
06:59
@JamesMcNellis Yes, there are questions already linked from there.
So add a "FAQ/Popular/Useful Questions" section?
@gman @antonK : the second one with "prefix_length"
The Neil Butterworth Memorial C++ FAQ List
lol
@neversaint In uint64 mask = (1 << prefix_length) - 1;, << bit shifts to the left.
1 << 0 doesn't shift, it's one.
sbi
sbi
I think SO is a very good place to prevent this from happening.
But we might need more support infrastructure from SO to do this. Like the possibility to close a question as an FAQ dupe, pointing to the right FAQ question. We might not need this right from the start, but once this system is established, it might be relatively easy to get this feature. This is why I think this whole idea should be discussed at meta. People in other tags might have the same idea, after.
07:02
1 << 1 shifts, it's 2, 1<< 2, shifts twice, it's 4, etc. 1,2,4,8,16...
It's a simple way to get a power of two
I agree we can talk about the question on Meta; that's probably easier than here anyway
Yeah. Who wants to ask?
@Gman so "mask" is a number right?
07:03
Righto, it's a power of two minus one.
mask = 2^(prefix_length) - 1
so if prefix_length = 2 then mask = 3
sbi
sbi
Well, at least I thought there were questions linked from that page. Now I see there aren't.
@neversaint Yup.
@neversaint: yes. Basically, this takes 1, shifts it left N places, which gives a 1 followed by N zeros. It then subtracts one, which produces N 1's with zeros to the left of that.
07:04
@sbi Oh: It was C that I added a few question links to: stackoverflow.com/tags/c/info
sbi
sbi
@GMan Ask what?
@JamesMcNellis @sbi
sbi
sbi
@JamesMcNellis I'd never have seen anything in the C tag. :) I'm a C++ nazi.
@GMan Yes? :)
@sbi: Are you going to suggest this idea on Meta?
I can, but not until tomorrow night.
@sbi The link. :)
07:06
How, exactly do questions end up in: stackoverflow.com/tags/c%2b%2b/faq ?
sbi
sbi
@JamesMcNellis If you want, me to I could do this today.
@JerryCoffin I think it's the number of references to them. Not sure, though.
@JerryCoffin I believe they are the most-linked-to questions. The books question is first thanks to @g_man
: D
@sbi Sounds good
Oh, looking at the bottom of the page, it's based on links. Perhaps somebody could be given moderator-like ability to add/delete questions there?
07:08
I also link that 3rd one a lot, sbi is responsible for the 5th.
@JerryCoffin Some of those questions are very good and could form a good basis for a FAQ
sbi
sbi
@JerryCoffin I don't think this would be good. That's what the tag wiki is for.
@GMan I also link a lot to the book list. And that 5th question earns me a lot of rep. :)
@JamesMcNellis Most definitely.
lol, I suspected. :)
sbi
sbi
@GMan Whom? What?
(I'm still confused by so many threads running in parallel. I'm a dino from the Usenet era.)
That you gets lots of rep from it.
Haha.
07:12
Do you know if `auto` will be usable for class member variables? Like:
`struct Foo {
auto a = 5;
};`
@Tomaka17 It is not and will not be.
sbi
sbi
@Tomaka17 I hope not.
Even so: Ew.
The idea was: auto a = std::make_uniqueptr(createBar(...), &destroyBar);
Oh boy, it's Tuesday already... later, everyone
07:13
Instead of writing std::unique_ptr<Bar,decltype(&destroyBar)>
@James: Night.
sbi
sbi
@sbi So do you think that I should make this a question on meta later today?
@sbi Sure, but don't put things out of your way for it.
it seems to me, just having someone go through archives linking to 'good' questions would be a viable strategy, so as to keep stackoverflow.com/tags/c%2b%2b/faq in good order.
sbi
sbi
@JamesMcNellis See you. (It's been Tue for nine hours around here, way too few of which I slept.)
07:15
@Tomaka17 You're making that function, yes?
@GMan Yes
The problem with unique_ptr is that you have to specify the type of the destructor in the template parameter, which often leads to redundancy
sbi
sbi
@goldPseudo How do you want to do this? Many of those questions have several k of views. That's a lot of linkage to trump.
Right.
@sbi: what exactly did you plan to ask on meta? I'm kind of thinking in the direction @goldPseudo just suggested -- link to existing questions, and possibly write/answer/link to new ones where there isn't a suitable FAQ, to ensure everything on that page really is a FAQ.
The big disadvantage I see is when that page runs out of space, there doesn't seem to be a pointer to the "next most linked questions"...
not sure how the system calculates a 'frequently' asked question. seems it's more concerned about links, not views.
07:18
@Tomaka17 Don't make_xxx functions typically take the parameters directly? How would it know the last one was the deleter?
sbi
sbi
@JerryCoffin (I linked to that chat entry, but it's now gone through the roof.) Basically James and I thought of taking this discussion we're leading here to meta. I thought of doing at around 10am PST, because the C++ tag is nicely crowded around that time. Also I meant to ask on SO first, then have the question moved to meta, so it gets more exposure to the C++ crowd on SO.
@GMan: In this case I would make it take the pointer instead, but I recognize this is not really the way to go
sbi
sbi
@goldPseudo I think it's based on linkage. I just assumed some correlation.
Wait, if make_unique takes the parameters directly, you don't need to specify a destructor since make_unique constructs the object
@sbi: 10am PST does sound like a reasonable time for that. I'd better get to bed so i can be up by then too...night all!
07:21
assuming the 'linked' list on each question is complete, that's less than 50 links needed to get on the top of the list.
sbi
sbi
@JerryCoffin See you!
@Tomaka17 Ah, right. So I think in this case you need a different function name. @JerryCoffin Night!
only 11 links on the bottom one.
sbi
sbi
@goldPseudo I think that lists the questions linked from that question, not the ones linking to it.
@Tomaka17 How about we start with a utility function:
template <typename T, typename Deleter, typename NewDeleter>
std::unique_ptr<T, NewDeleter> change_deleter(std::unique_ptr<T, Deleter>& pPtr, NewDeleter pDeleter)
{
    return std::unique_ptr<T, NewDeleter>(std::move(pPtr));
}
07:24
@GMan Why would you change the deleter of a unique_ptr? You can't be sure that the object will be deleted properly?
Yeah, that's a bit silly.
just browsing through stackoverflow.com/questions/199333/… (the last one on the FAQ list), i don't see a single stackoverflow link going /from/ the question or answers, yet it still has 11 'linked'.
i think the 'linked' is bidirectional. either links to or from are listed.
not sure if adding the questions to the tag wiki would count as a 'link', but it's as good a place to start as any.
The real problem I came upon is that make_unique<Object>(...parameters for Object's constructor...) can theorically use any constructing/destructing idiom (not necessarly new/delete) ; but in practice you have to know in advance the type of the deleter because it's in the unique_ptr's template parameter
Not sure if I was clear
@Tomaka17 How about:
template <typename T, typename Deleter /* = std::default_delete<T> */>
std::unique_ptr<T, Deleter> to_unique_ptr(T* pPtr, Deleter pDeleter /* = Deleter() */)
{
    return std::unique_ptr<T>(pPtr, pDeleter);
}
Uncomment those if your compiler supports default template parameters on functions, otherwise you'll have to split it.
auto t = std::to_unique_ptr(createBar(...), &destroyBar);
@GMan: Yeah but what if I want a unique_ptr class member variable? I'll have to write std::unique_ptr<T,Deleter> anyway
07:29
Ah, yup lol. Nothing you can do about that, members need explicit types.
:(
This is not a problem for trivial destructors (like destroyBar) but it gets more complicated when you use std::bind, std::mem_fun or a lambda for example
I would move that into its own type and use that.
std::unique_ptr<Bar,decltype(std::bind(&destroyBar, static_cast<BarManager*>(nullptr), _1))> myPtr; phew!
Eh, I would definitely move that into its own type
sbi
sbi
@goldPseudo Yes, you might be right about that. I always thought it's the other way. Maybe it's both ways?
07:33
Well my solution at the moment is to use shared_ptr instead
sbi
sbi
@goldPseudo The link from the tag wiki would be one link. If even the least linked to question has a dozen already, I don't think this would change much.
@Tomaka17 Eh, kinda a non-trivial switch, for what gain?
sbi
sbi
Also, as was said before, there's only so much question to be listed on that page. And they will not be in a nice order. You cannot group them by theme. How are you going to find anything in there?
@GMan It's just because you don't need to specify the type of the destructor in the shared_ptr type, even though the program runs a bit slower then
@sbi If there aren't even a dozen questions (either in the archive or newly asked) that can be relevantly linked to a question, it probably isn't "Frequently asked" in the first place.
07:37
@Tomaka17 You only write the code once, but you'll use it many times.
sbi
sbi
@goldPseudo That's what that page is good for. It lists questions that are frequently linked to. It does not, however, help you to find out whether a question you are about to ask was already asked and has a good, definitive, approved-by-the-high-rep-regulars answer.
But this problem is not only related to unique_ptr anyway ; take set for example, where you can specify your own function for sorting values
sbi
sbi
And the page doesn't link questions that can be linked to there either, just those which have been.
Anyway, I'm outta here, too. I really need to get to work now. See you tonight (on a down-bound train... Sorry, pavloving here)
I had a (mathematical) Vector class, and the logical operator< for a Vector would be to compare their length, an expensive operation
So when I put the Vectors in a set, I wanted the set to sort them using their x coordinate for example
So: std::set<Vector,???> mySet(...lambda for comparing x values...)
But that's not convenient
You're over-using lambda's.
07:42
But I don't want to create my own structure just for a single set :p
They're for local (function local) function types, not for persistent function types.
I want more laziness!
Again, you only write it once. Just underneath your Vector class:
struct vector_compare
{
    bool operator()(const Vector& pFirst, const Vector& pSecond) const
    {
        return std::make_tuple(pFirst.x, pFirst.y, pFirst.z) <
                std::make_tuple(pSecond.x, pSecond.y, pSecond.z);
    }
};
Ta-da! Cleaner than a lambda, and more usable.
@GMan I don't know if it's a good practice, but I often use lambda to replace the signal-slot concept
I think that's a good example of where it should be used.
07:45
myButton.onClick([]() { ...handle here... });
Since you only need to define that functionality in one spot, locally, one time.
Note that's different than our last two cases, which (tried) to make the lambda persist.
I misunderstood what you called "local"
So you think we shouldn't store a lambda in a persistant std::function object for example?
No, you should. The value of the lambda expression can persist, the lambda expression itself shouldn't.
I guess to state what I've failed to more succinctly: Try not to put yourself in a position where you need to repeat the lambda expression. If you do, it should probably be made into it's own functor for repeated use.
Ok I see
what's the difference between "++i" and "i++" ?
as in for (int i = 0 ;i < foo.size(); ++i)
07:55
++i increments and then gives you the resulting value
i++ gives you the value then increments
Hi guys, I have a question concerning exception safety.
In your case (fundamental types), there is no difference.
But for class types, i++ can be more expensive since it needs to make a copy before incrementing (so it can return the old value).
This leads to the guideline: prefer pre-increment over post-increment.
Suppose my constructor does an Alloc(...) and my destructor does Release(...) of that resource, and my class is made non-copyable.
I'm still not safe it turns out because if my constructor throws, it's destructor isn
*isn't executed.
@neversaint You can find more information on the parent site, or with Google (with site:stackoverflow.com prefixed to your search.)
@Gman ok thanks so much
07:58
@neversaint np. @StackedCrooked So you mean you get your resource, then do further stuff, and if they further stuff throws then you leak?
Should this be solved by using a separate init() method ?
@Stacked: You should create another class which only calls Alloc and Release
@GMan, yep, or perhaps the alloc call can throw as well.
Well if that's the case then you don't want to call the destructor.
Could you post a stripped version of the class?
Hmm, let me check.
07:59
In general, though, you're already doing too much. Do one thing, either manage a single resource or use multiple resources to do a single task. You're managing multiple resources, or managing a single resource and using others. That's bad.

« first day (10 days earlier)      last day (5164 days later) »