« first day (25 days earlier)      last day (4914 days later) » 
00:00 - 20:0020:00 - 22:00

12:07 AM
Hello ! Any one in here familiar with the Facebook Puzzles ?
 
no
:-=
With a million rep points, and a cap of 200 rep points a day, I figure it would take 5000 days to get that far, or 13 years, but SO isn't 13 years old, is it?
 
12:54 AM
01:53 in Norway... :-)
 
1:07 AM
ok. c++ is called a "multi-paradigm language". means you can use it in many ways, not just OO. OO isn't something that is there. it's added by the designer/programmer. like an artist removing stone and uncovering a sculpture within. sort of.
 
@Alf P. Steinbach I don't follow
 
@AlfPSteinbach SO is only two years old, plus a couple of months. However, the cap only applies to reputation received from upvotes, not to reputation received from accepted answers and bounties. So, if you get a whole lot of accepted answers and huge bounties, you can get there faster.
 
@AlfPSteinbach if you want a lot of rep, ditch c++ for java and c#
more questions == easy rep
 
Or C#.
 
@Shiftbit: tina was discussing what she's doing, yesterday. essentially it's about modeling a system that will do some geographical info system stuff like finding intersections. for this, she has a "geometries" union containing pointer to point, pointer to line, pointer to sequence of lines, so on.
 
1:11 AM
@JamesMcNellis: I didn't even have to edit to include that :)
 
interesting
 
@roger: no i don't care for reps except to the degree it enables functionality. next for me would be moderator tools. but i'm to busy moderating [comp.lang.c++.moderated]. ;-)
 
@RogerPate Oh. I haven't had enough coffee yet today. :-O
 
@Alf: you don't want access to moderator tools
a few little [homework] retaggings and it seems everyone wants to give me grief
 
@tina: you have me confused here. i must leave. i only meant, do things a way that you understand. if something turns out to not work well (you might find this when getting down to coding), go back, fix it, or do something else. all design and programming is iterative. goes in circle, improvement every time round. cheers,
 
1:18 AM
@Alf: did you realize you don't have to include "cheers & hth" on every post?
 
@roger: now that you mention it... aha! cheers! afk
3
 
1:32 AM
I never knew people really had such a problem with UB until I came to SO.
maybe it's partially that rep attracts ... something, like this (now deleted)
 
1:54 AM
yay my iphone/ipad app has been accepted by apple!
2
 
ub?
 
2:11 AM
@wilhelmtell Undefined Behavior
 
oy. of course. context what have helped me figure it out. :s
 
"how did you know I didn't mean Unspecified Behavior?"!
 
or ubisoft?
 
@tina: why would you overload like that? just write one function instead of one for a pointer and one for a reference
 
2:34 AM
@tine give an example of a confusing const
 
@tina It means that this is const-qualified and you can't change any of the members of this or call any member functions that are not const qualified.
 
@tina you have a number of const keywords there. In general const means asking the compiler to make sure things don't change. What the compiler keeps constant depends on where the const keyword is.
 
I was referring to the const at the end of the declaration.
 
In the case where the keyword is at the end of the a function signature, as in int Klass::f() const, this means the compiler will make sure the member function does not change the object to which it belongs. If you try to change the object inside the function the compiler will halt with an error message.
 
The const at the beginning of the declaration (const Bool) is unnecessary and (assuming Bool is not a class-type) is meaningless.
 
2:48 AM
You can deduce from that that a const at the end of a function signature only makes sense if it's a member function. None-member functions aren't part of an object, so it makes no sense to ask the compile to check they don't change an object.
 
(Speaking of which, what is Bool and why not use bool?)
Yes, because it applies to the return type.
 
Then you can have the const at the beginning of a function: const int& Klass::f(). Here, the const qualifier asks the compiler to make sure that the caller of the function does change the return value. The compiler will then stop you from doing something like
Klass k;
k.f() = 3;
Of course, if the signature was const int Klass::f() then that wouldn't mean much, because until a variable holds the return value, the return value is a temporary and so it can't be assigned to.
@tina almost. It only makes sense to specify a return-value as const if it is a reference.
@tina ok, again..
Remember the class std::vector<> ?
Ok.
If you recall, it has a member function with a signature along the lines of T& operator[](size_type n)
meaning, the bracket operator.
so it allows you to do something like std::vector<int> v; and then v[0] = 0;
What happens there is that you call a function, the bracket operator, and you assign a value to its return-value.
Are you following me?
@tina?
Are you following?
All I'm saying is that std::vector<> has a function that returns a reference.
it allows you to say v[0] = some_value;
and the way it works is by assigning to a return-value of a function. v[0] is a call to a function.
Now. Sometimes, you might want to create a const vector: const vector<int> v. As things stand, we have a problem: the bracket operator returns a reference, which means you can call that function, get a reference, assign a value to it and voila, you a changed a const object.
that's not good.
so for this purpose, there is an overload of the bracket operator, which returns a const reference. This time again the function returns a reference, but a const reference, so saying v[0] = some_value will not work.
So, the idea is simple. Sometimes you want to return a reference, but you don't want it to change.
the overload looks like so: const T& operatpr[] (size_type n) const;
exactly.
Sometimes you have an object with large internal data. Returning the data by value might be slow, because it means copying a whole lot of data. So, you'd return it by reference. But there's a problem here. For example, if you have Data& Klass::f(), then users can say f() = other_data; and this might not make sense. To forbid it, you change the signature to const Data& Klass::f();
 
3:18 AM
@tina: Do you have a good introductory C++ book?
 
4:13 AM
You need to get one of those books.
 
@tina: then you will fail; get a book
then you will fail. not maybe or possibly, will.
figuring out C++ when you already have some idea of what you're doing is hard enough as it is; for beginners without a book it's an impossibility
 
Just about every C++ resource on the Internet is flawed. Most of the advocate bad practices (out of ignorance, I presume; I don't think the authors of online resources are advocating bad practices out of malevolence).
 
be especially careful of any online C++ resource that claims to be a "tutorial"; those tend to be extremely bad
the best you can hope for online to learn any language, when you're also just starting to learn how to program, similar in complexity to c++ (I'm including java, python, and many others) is a real book that's been published online (usually in addition to a dead-tree edition)
sure, if you want to fail
get one; go to a local bookstore that has a cafe and read a few c++ books for a couple hours
 
Right. You need to buy one or ask your employer to buy one for you.
 
Programming: Principles and Practice using C++ or Accelerated C++ are both good choices
but read through them all and find what appeals to you
@tina: can you afford a cup of coffee? I frequently spend $2-4 per week on coffee in the bookstore and read for a couple hours
(suppose it helps that they have wifi :P)
libraries have books too
 
4:28 AM
@RogerPate I get more work done at Starbucks than I get work done at work.
2
 
I would put extremely low faith in any c++-beginner material on youtube
2
what do you mean by soft copy?
electronic? nothing on this laptop
 
I have a lot of books in PDF form (you can get some good books in PDF form), but you have to buy your own (it'd violate copyright for me to distribute them, obviously).
 
which lists Thinking in C++ and How to Think Like a Computer Scientist
those two are decent — much better than most online resources — but not as good as the two books I mentioned earlier
(there are some bad resources on that freeprogrammingresources.com page too)
 
 
1 hour later…
sbi
6:03 AM
@tina To emphasize what the others said:
Once you know C++ well, you might be able to pick up many of the curly braces languages from trial & error and a few online tutorials. However, *you will not be able to learn C++ that way.* There's a reason there are so many bad C++ books out there. (And when I say "bad", it's not as in "badly written", it's that they get the facts wrong.) C++ is huge, it takes years to master, despite the best resources money can buy.
Read a book or you will fail to learn C++.
 
weird, asterisks tend to work better than underscores
might be related to the "see full text" link
 
sbi
@Roger Once again markdown is letting me down here.
 
it's not just you, it fails in strange and inexplicable ways often — but SE has 4 different flavors of it, so it's not just Markdown, per se
 
sbi
To me "see full text" makes no difference except that the "see full text" link is gone.
What's the fourth? Do wikis have their own?
 
yeah, it looks like the cutoff is right where the link is placed
wikis are no different from posts, that I know of
 
sbi
6:06 AM
So what's the fourth?
 
I was thinking of the very-non-standard (for Markdown) extensions they have in some contexts
 
sbi
Questions/answers, comments, chat, and?
 
the LaTeX-like stuff for math and the "hidden" feature of turning SE links into post titles (questions only)
 
sbi
Ah, I would never see math stuff. :)
 
it doesn't work on SO; iirc it was mainly used for Math Overflow but is now also used on a couple(?) of new SE sites
@sbi: the other feature mentioned: meta.stackoverflow.com/q/69483; and there's the new [tag:tag-name] syntax (I think it's really not worthwhile); and I thought there was another extension...
 
6:10 AM
I thought the [tag:thing] was kind of silly...
 
@tina: Don't be vague, be an ace; write a proper test-case!
 
@tina: You have this backwards: you should read the links Roger provides first because they explain how to ask good questions and how to help us to answer your question such that it is as helpful to you as possible. Then after that you should ask your questions...
 
sbi
@Tina Once more: I can understand that computer books cost more than you can afford. We've all been students, I have been a poor student (and now I have more kids than others have books).
But you will not learn C++ unless you have a book, and you will need a good book. )Again, that is one that has the facts right.)
 
@tina: I can't speak for everyone, but I'm having a harder time understanding you than I usually do for beginners
 
sbi
Ok, I'm outta here now. I have a hard task to attend to today and will be offline most/all of the day. See you all.
 
6:16 AM
well, maybe not usually; I'm generally spoiled in that most beginners I see either pass the IRC or Usenet competency tests (or they're on SO and I can go elsewhere)
have fun
 
@sbi May the force be with you
 
sbi
@RogerPate Oh Roger, I need to bury someone.
 
offline all of the day sounds like a farce ... oh, force
 
sbi
No fun at all.
 
Oh :(
 
6:18 AM
@sbi friends will help you bury a water line; true friends will help you bury a body
(I couldn't fit that saying with anything better for the first half; what do you normally bury?)
though it just struck me you meant that literally instead of figuratively
(feel like a huge ass now)
 
@RogerPate Yeah... I hate it when that happens :|
 
6:39 AM
int table [10][10]={{0},{0}}; — oh, where to begin
 
Ha ha. The initializer has eyes! {{0},{0}}
 
that was my thought too! o_O
what other SE sites do you guys watch?
 
There are other sites?!
 
shocking, I know
 
6:55 AM
I visited the math site the other day and learned why doing laundry sucks so much... it involves ridiculous amounts of advanced math that I just don't understand.
 
hah
 
Before I read that I thought I owned a lot of t-shirts. Now I know I own a collection of punctured topological spheres...
 
 
2 hours later…
8:37 AM
#include <iostream>

using namespace std;

double cube( double *s)
{
return *s**s**s;
}

int main()
{

cout<<"enter the side of cube";


double side;
cin>>side;
cout<<"the volum of cude is :"<<side<<"is "<<cube(&side)<<endl;
return 0;

}
 
user69820
@tina basically, you need to dereference your pointer to get the value at the address it's pointing to
 
user69820
ie *s
 
user69820
so your function would become (@Arman says)
double cube(double* s) {
return (*s)*(*s)*(*s);
}
 
9:01 AM
is there a point to adding another level of indirection?
 
9:27 AM
@tina what error?
you're changing the value of s inside your cube function, so it violates the const-ness
remove the const from the parameter of your function or don't change the value of s inside your function
yes but you're explicitly changing your value in this line: s = s*s*s;
const means that the value of your variable may not be changed
so by defining your parameter as const you're guarantueeing the caller that this function will not change the value of the parameter
so you should do return s*s*s; in your func if you want a const param
this line `void cube( const double &s)
should be double cube( const double& s)
now it can return a double value
and in your main you need to do:
double result = cube(side);
then pass result to your cout
 
9:49 AM
huh?
your function parameters have no relation to your return value of the function. Your function may return something even if the parameters being passed or not const
you need to do something about your english
be more specific, what aren't you getting about the return type?
yes return type double means return a double
return type int means return an integer
 
 
3 hours later…
1:24 PM
@tina get a book and read it
good
it is "but i'm still wondering about it"
 
 
1 hour later…
3:04 PM
I just realized: to sleep with a C++0x thread you have to call sleep_for and to sleep from a boost thread you have to call sleep... yet another incompatibility :(
 
3:46 PM
:( that sucks
afk
 
4:36 PM
why does it suck? doesn't seem like a big problem really
 
 
2 hours later…
6:36 PM
@wilhelmtell: I've been checking if you had posted any more information; then saw you here so I thought I'd ask directly :)
 
6:54 PM
Hi. I'm having a problem with this linker error (quoted). Here's some unrelated code. What's up?
 
@Alf: which question is that?
 
Lot's of them, this is the latest for C++...
 
7:08 PM
@RogerPate I wasn't really satisfied with any of the answers. I'm still reluctant to think there's no portable way of finding cpp's search paths. It just sounds so obvious for me, part of what cpp is supposed to do. As for user-specified paths, I said I can ignore them, because I can take them as parameters just like g++ and cpp do.
 
I wasn't satisfied with the answers either, that's why I was trying to find out more about your purpose
@wilhelmtell: I did understand you could accept additional paths, but if you want to be perfectly portable, I didn't see a way to extract that information when it's embedded in makefiles
 
That question was part of an effort to generate ctags efficiently with Vim. Parse source files and create tags only for the files I need.
when a source file reads #include <header> I needed to know where that header is. There might be a few instances, and I needed the one cpp would take.
Granted, I could just generate tags beforehand for all the libraries I have. But the problem with that is that some of them are large and difficult for Vim to digest. For example, if I remember correctly Boost.typeof weighs in the gigabytes. In Vim C-x C-o then takes in the order of minutes (or nearly so) to complete.
I also disabled omni-expansion on the scope-operator for that same reason: std:: would be unbearably slow. I didn't bother trying boost:: ...
So I was looking for ways to speed things up, and that was one of those ideas for heuristics...
 
7:25 PM
are you replacing exuberant ctags or other ctags? (if so, why?)
 
i was using exuberant ctags
didn't replace anything.
 
that is, I thought etags already knew how to find system includes
ah
 
ctags
i'm with Vim
 
etags = exuberant ctags
 
ah k. thought you meant emacs tags
it doesn't.
you have to tell it what files to look in. for what i know.
 
7:28 PM
my experience is rather limited with it, beyond basic use where I press F12 to regenerate for the "current" project :)
 
do you use boost?
how do you handle typeof?
how do you handle std:: ?
 
I do have a project started to handle the stdlib
I've not yet committed to 0x for other than playing, so typeof isn't yet an issue
 
what i did was use only select libraries in boost. i managed to shrink the tags file to ~74mb
yay.
it's insane. vim chokes.
 
boost, with all the macro crap, would be a nightmare
it's exactly that macro crap that's made me resort to redeclaring the stdlib... ><
 
yeah.
i think the nature of etags also doesn't help
i mean it's text
or maybe vim doesn't integrate with it efficiently
Searching shouldn't be that slow. Boost's tags weigh at 1.1gb. That's a lot, but c'mon, Google manages much larger blobs just fine.
 
7:34 PM
there are a few directives vim recognizes at the start of the file to control searching
the basic problem (as I'm sure you're aware) is it's inefficient to binary search variable-length lines
 
Well I think Vim should read the tags file once, and then generate an efficient datastructure for. DBMS do that too.
 
while tags simply use plain text because it's convenient and C was (probably) the main use-case at the time
yeah, if I was familiar with vim source, I'd take a stab at implementing that :)
if you donate, you can propose and vote on new vim features
 
But I also think tags files should be binary.
because they update frequently.
i'm not a dbms expert, so i don't know how you do that. maybe tags should be in a sqlite file or something.
eah
yeah
that's a worthy goal. that would make vim a somewhat tolerable ide even
not any more "just" a text editor. :)
 
I don't think they should be binary, but vim should have a way to convert the text for internal use (and a way to do that just once every time the tags file is updated)
 
Can you imagine reloading gigabytes of data every few seconds?
 
7:42 PM
for projects you're currently editing, running just modified files through tags and incorporating that into the binary format would be fast enough — keeps parsing out of the editor and in a separate language-dedicated tool
the problem is really that C and C++ make this awful because of macros
 
why? macros are static. you can pipe from cpp, can't you?
 
hey guys
what is the Unicode snowman character again?
 
i donno i honestly have no clue about this. i was too lazy to dig into it.
:-S
 
@wilhelmtell: I mean you can't parse a file in isolation; consider boost's complex config header and macros
you can't know how included files will affect a small modification, cpp has to reparse everything included
 
Yeah.
Well, be back later... Back to work. :-S
 
00:00 - 20:0020:00 - 22:00

« first day (25 days earlier)      last day (4914 days later) »