« first day (30 days earlier)      last day (4919 days later) » 
00:00 - 19:0019:00 - 00:00

12:30 AM
good evening :)
 
Good mid-afternoon!
 
1:23 AM
why do you like UML diagramming so much?
 
1:47 AM
@tina also consider, perhaps UML is not a good tool for the detective work (that it seems to me) that you're doing right now?
 
lol tina is bugging him again xD
 
@johannes it's bugging me because when i see someone who's really stuck at something i really want to help. but advice such as "read The Art of Motorcycle Maintenance" doesn't cut it, although that would be best! problem is, very difficult to understand what the Real Problem really is...
 
i understand
John <3
 
By the way, that book: The Art of Motorcycle Maintenance -- should be required reading for every programmer...
 
1:56 AM
I especially liked the passage where Paedrus had a student who should do an essay about a town. He narrowed it down to the main street. Nope, she was still stuck. He narrowed it down to a building on main street. Still stuck. The front of that building. Still stuck. Finally, asked her do essay about a single mortar stone in front of building. And that did it!
uh, perhaps that should be "brick stone"? i'm not english
 
It'd probably just be "brick" or "stone."
 
2:13 AM
someone talking to me?
 
@JohnDibling I think that was Johannes after Tina calling him "John", like
:-)
 
3:05 AM
ohh yes sorry for waking you up -.-
 
zzzzzzz
huh?
 
is somebody there?
 
Nope. Nobody here.
 
oh, ok. zzzz
 
3:29 AM
4:31am xD
 
7:31 pm
 
9:36 PM
 
3:47 AM
22h31
well not anymore. but yeah.
my clock is the best.
 
 
2 hours later…
5:58 AM
Stop talking so much!
 
@James
wow you work at microsoft
 
@Reno
Shhhhh, don't tell everyone! It's a secret.
 
haha ok
 
i wonder how many design patterns did they expect you to know when you were answering their interviews
btw tina is lurking around to get her questions about diagrams answered
 
6:12 AM
I don't know how many they expected me to know. I can't say that I ever mentioned a specific design pattern by name in any of my interviews.
 
hmm i hear a lot of stories all the time .. good to know from you , thanks
 
I would guess that every interview experience is different.
 
yeah just ones luck ;)
 
There's always some "luck" when interviewing, especially in how well the interviewee and interviewer communicate with each other. Mostly, though, it's about knowledge and skill.
 
6:35 AM
Hi @James. Your secret is not a secret any more I guess :) We're cool as long as you don't work in C++ Compiler team :)
 
I do not but there are a lot of very smart people who do.
 
C++0x stuffs added.
16
A: FAQ : Undefined Behavior and Sequence Points

Prasoon SauravDisclaimer : Okay. This answer is a bit long. So have patience while reading it. If you already know the stuffs reading them again won't make you crazy. Pre-requisites : An elementary knowledge of C++ Standard What are Sequence Points ? The Standard says At certain specified points i...

 
@Prasoon - Great article
 
I thought the purpose of the FAQ was to have questions to which beginners could be directed.
 
@James: I know many very good people at MS (like, you're there, Petzold was, Pietrek, was, etc.). Still, when I click on volume control takes ages to appear. When fix?
 
6:43 AM
Haven't you seen how many beginners ask the "is ++i + ++i undefined" etc?
2
 
@ArmenTsirunyan thnx :)
 
I meant, "I know there are..."
 
Yes, I've seen more than enough questions concerning sequence points, but the answer is, IMO, far too long to be useful for pointing beginners in the right direction. In addition, anyone who has "An elementary knowledge of C++ Standard" has at least a general idea of what a sequence point is.
@AlfPSteinbach Works on my machine! ;-) (and please don't name me in the same list as great men like Petzold. :-O)
 
@JamesMcNellis I am sorry but I couldn't make the post shorter. :(
 
@Prasoon: I haven't looked at your answer but I'm sure it's fine standard-wise. But I bet you don't go into how loading and storing registers can foul up things. I think that's the concrete that beginners need about sequence points, what they're for (allowing the freedom to do that which-values-in-registers shuffling). Also perhaps include note about examples in C++98 standard wrong :-)
@james: ah, i'm running XP Prof SP 3 (on very old machine)
 
6:51 AM
Talking about length of an answer. What do you guys think about this post? Its one of the longest posts that I have seen so far.
162
A: How does Subnetting Work?

Evan AndersonIP subnets exist to allow routers to choose appropriate destinations for packets. You can use IP subnets to break up larger networks for logical reasons (firewalling, etc), or physical need (smaller broadcast domains, etc). Simply put, though, IP routers use your IP subnets to make routing decis...

 
my face when i see things like that
 
@JamesMcNellis So should I change "An elementary knowledge of C++ Standard" to something else?
 
7:18 AM
@Prasoon: IMHO, you shouldn't change that. Because there are topics that just can't be thouroughly understood by beginners. Imagine a person who doesn't even have basic understanding of pointer arithmetic, then hears from someone that ++i + ++i is UB and asks the question in SO. How would you explain to him sequence points so that he/she understands it? IMHO the FAQ should be not only for beginners, but also for intermediates and even advanced. Just a personal opinion
 
 
2 hours later…
sbi
8:56 AM
Can anyone please help me look at stackoverflow.com/questions/4182579/constructor-in-c? I'm lost in a maze of dupes...
 
user69820
@sbi I thought @tina actually got the answer in chat too
 
sbi
@oracle I have long since given up on tina. I'm still trying to find the best dupe to link the others to, though.
 
user69820
@sbi don't give up on @tina!
 
sbi
@oracle Well, there's only so much a man can do...
Anyway, got to go now. I'll be back online in about 1.5 hours. See ya.
 
9:16 AM
on a stringstream operator << does it copy by value or by reference if you assign a char* to it?
 
sbi
10:11 AM
@Tony What do you mean?
 
sbi
10:29 AM
(I'm fiddling with the feeds, which seem to be broken, so don't be surprised if a ton of feed items pop up all at once.)
 
@sbi if you use the operator << from the stringstream class, then how is the value copied into the stringstream? By value or by ref?
so char* p = "test"; stringstream ss; ss << p; <-- by ref or by val copy p into ss?
 
Hello everyone. :)
 
sbi
@Prasoon Hi!
 
@sbi Managed to add C++0x to that post. It has become a bit too long :-)
18
A: FAQ : Undefined Behavior and Sequence Points

Prasoon SauravDisclaimer : Okay. This answer is a bit long. So have patience while reading it. If you already know the stuffs reading them again won't make you crazy. Pre-requisites : An elementary knowledge of C++ Standard What are Sequence Points ? The Standard says At certain specified points i...

 
sbi
@Tony A stream has an internal buffer. Everything you write to a stream will be copied into the buffer from which it (might get read or) eventually be written to a device.
Stringstreams never write to a device. Instead you can get a string that's a copy of the buffer's content.
Does that help?
 
10:44 AM
@sbi I guess
 
sbi
@Prasson You should put that into its own answer. And probably break down your answer into several ones, as was discussed re Armen's answer.
In order to preserve the right order (voting would fuck this up), you can link to it from the question and link from one answer to the next.
Just my $0.2, though.
 
@sbi Yeah initially I thought of breaking it into two but see Evan's answer here.I think its longer than my answer. So I decided to add the stuffs to the existing answer. :)
 
sbi
@PrasoonSaurav I really wouldn't take that as a good example. Have a look at this one instead:
129
Q: How does "Reputation" work?

Justin StandardIn the Stack Overflow trilogy websites, users may gain a certain level of Reputation. What does Reputation do? How can a user gain or lose Reputation? Return to FAQ Index See also: Are there any voting limits? Maximum amount of votes and reputation a user can gain or use in a day. ...

It's even an FAQ, so it already does what we strive to do.
 
@PrasoonSaurav "I loved sequence points. :(" Indeed I did!
@PrasoonSaurav Please make the C++0x stuff another answer (can the same person provide two answers to one question?) so I can vote you up again.
 
sbi
11:03 AM
@FredOverflow I think you can.
 
@sbi Excellent! </mr_burns>
 
Okay fine I am making it as a separate answer. :-)
@FredOverflow Done
0
A: FAQ : Undefined Behavior and Sequence Points

Prasoon SauravThis is a follow up to my previous answer and contains C++0x related stuffs.. Pre-requisites : An elementary knowledge of Relations (Mathematics). I heard someone saying that there are no Sequence Points in C++0x, is this true ? Yes! This is very true. Sequence Points have been replaced ...

@sbi Done! :)
 
sbi
11:50 AM
Can you guys have a look at my comments to stackoverflow.com/questions/4182579/constructor-in-c?
 
user379888
12:30 PM
hello,all
 
user379888
Any having command on graphics.h?
 
user379888
?
 
@sbi and...
 
1:25 PM
My posts have been made CW here. :(
17
Q: FAQ : Undefined Behavior and Sequence Points

Prasoon SauravWhat are "Sequence Points"? What is the relation between Undefined Behaviour and Sequence Points? I often use funny and convoluted expressions like a[++i] = i;, to make myself feel better. Why should I stop using them?

 
sbi
@PrasoonSaurav Wow. Do you have any idea why?
 
@sbi Not at all. I have very disappointed at the behaviour of Will (the moderator) x-(
I dont know what went wrong. :(
One more thing. Only my posts have been made CW. I mean he hasn't even touched any other thread tagged c++-faq.
 
sbi
@Prasson I've flagged it for moderator's attention, asking why this was done.
 
Okay thanks. :)
@sbi : Should I create a thread on meta asking for an explanation or wait for Will's response?
 
sbi
1:43 PM
@PrasoonSaurav I'd wait.
 
Okay...I shall wait. :)
@sbi : You there? Bill the lizard is asking me to open up a new question on Meta. Check out his comment here.
 
sbi
1:59 PM
@Prasoon It's working hours here, I can only look so often whether anything interesting has arrived.
I've now added a comment.
 
Yeah seen that...Thanks for the support. :-)
 
sbi
:)
 
:-) :-)
 
2:17 PM
lol did Will make any c++-faq post CW?
 
0
Q: Should c++-faq tagged threads be made CW?

Prasoon SauravHello all. Yesterday I started this thread on Sequence Points and Undefined Behaviour and tagged it [c++-faq] after reading the following thread created by reputed member of the C++ community(tag) sbi Setting up a FAQ for the C++ tag and related [c++-faq] tagged questions like Copy and Sw...

 
responded
 
@John: Hmm seen that... see `What are sequence points? What is i = i++ + ++i?
You know the drill. Also covers C++0x.` thing in GMan's answer.
9
A: Setting up a FAQ for the C++ tag

GManIdeas for C++-FAQ Questions might be: How do I learn C++? What if I know another language? What resources should I use? Close to my heart. State my profile in a far nicer manner, explaining rationale possible "meta" tips about learning (how to avoid thinking in other languages, why not to, how...

 
lol. i like thathe made them CW tho. c++-faq being CW sounds good
 
i'll check it out
 
2:28 PM
i will try to set up an answer without standardese votes later on. i think it may look difficult for beginners to see these standardese :)
 
@JohannesSchaublitb : I asked James whether An elementary knowledge of C++ Standard should be changed and got the following reply from Armen.
7 hours ago, by Armen Tsirunyan
@Prasoon: IMHO, you shouldn't change that. Because there are topics that just can't be thouroughly understood by beginners. Imagine a person who doesn't even have basic understanding of pointer arithmetic, then hears from someone that ++i + ++i is UB and asks the question in SO. How would you explain to him sequence points so that he/she understands it? IMHO the FAQ should be not only for beginners, but also for intermediates and even advanced. Just a personal opinion
 
sbi
@JohannesSchaublitb I'd find this a very good idea. I see no harm in having several answers, all attracting different people.
@Prasoon Really, leave your answer as it is. It took a lot of knowledge and effort, and it's very good for what it is. If people like @Johannes' answer, too, I don't see any problems.
There's room enough for many ways to explain the same basic C++ concepts.
 
@sbi : Hmm right. I am going to leave it as it is but leaving the thread as CW(post) is unacceptable.
 
Yeah i agree to @sbi
 
sbi
@Prasoon I'm not sure they even can delete the CW flag. I wouldn't bet on it. Anyway, don't get too obsessed over it. You've earned a lot of rep on this one, and get eternal informal rep, even if its CW. :)
In a few weeks, you will have surpassed me in rep. What are you gloomy about?
 
2:36 PM
of course i would put standard references but i won't cite standard text. for those who want to follow from the standard POV, the references will then guide them
 
sbi
@JohannesSchaublitb I have posted much shorter answers to two of those FAQ entries and I really think they deserve their place.
 
@sbi : :-). My only question is why only me? Why weren't other similar threads made CW? :)
 
sbi
@JohannesSchaublitb To that I'd disagree. Those who want std references, will find them in Prasoon's answer.
 
@sbi ohh i see!
i will also add a bit of discussion. one point where a DR talked about is the meaning of "a = i = 0" in c++03. in fact on a strict reading this is UB in c++03 because you don't read the value of "i" to know what to store into i, but still you read and modify i between the same sequence points
 
sbi
@PrasoonSaurav Yours had a lot of discussion and a few down-votes. That might have played a role in Bill noting it. But then it might not. Who knows? I don't think anyone is trying to get you here. In a very short time you've proven to be a very knowledgeable member of the C++ regulars here. Don't be too obsessed about the rep. Yep, it makes this place tick, but, still, there's more to this place.
 
2:39 PM
these considerations were part of the reasoning making things like ++ ++ i explicitly defined for c++0x ("implementations already support part of it").
 
@sbi : Its fine,thanks :). Bill has confirmed that Once a post is made CW it's considered owned by the community, so there's no mechanism for giving it back to the original owner.
 
when i do a new faq q & a, i will ask a mod to make it CW xD
 
haha! :)
 
user379888
Hello all
 
user379888
Needed some help.
 
2:43 PM
i think next up is "what are dependent names?" haha
 
user379888
I am trying to generate graphics like the matrix wallpaper in C++ graphics (graphics.h)
 
sbi
There's an article about operator overloading on my mind. I hope I'll find the time and energy to do that.
@fahad This is the chat. Currently it has four active contributers, and that includes you. Post your question on SO. There's thousands of people out there looking at it within a few hours. If you want, post a link to here.
 
@JohannesSchaublitb From the viewpoint of a normal user, is it "what are dependent names?", or is it more like "why does the compiler say I need typename to get this to compile?"
 
and then enhancing that with the c++0x notion of "current instantiation" =)
 
user379888
@sbi thanks
 
2:46 PM
well after the name of "undefined behavior and sequence points" i would call it "typename, template and dependent names" haha
2
 
@JohannesSchaublitb That'd be nice. :D
 
sbi
@fahad You're very welcome.
 
user502230
hi
 
@Jerry the way i understood it, they were supposed to be linked like "hey to fix this look at [link to the c++-faq question". so it shouldn't be necessary to have typename in its title but it would be nice for search engines, i tend to agree
 
user502230
sup
 
2:51 PM
I had some nerdy fun yesterday to try and make an is_callable for some question. it works quite nicely. see ideone.com/SBZWS for the code.
comments welcome :)
 
sbi
3:03 PM
@Johannes No time, I'm busy hacking in C#. And shouldn't you be working on your thesis paper? :)
 
@litb: what is the topic of your thesis?
 
oh yes i should. i think i will start soon.
@John it's about implementing codegen and runtime support for a scripting/query language. it's top sekrit
so i cannot talk to ya about it really
 
LOL I'll give you 3 randon upvotes if you email it to me :
:)
 
@SaurabhManchanda : maze le ;-)
 
3:16 PM
Can someone give me a quick help on overriding functions? I somehow fail to make it work
 
@IvoWetzel what is the problem?
 
@Tony I declare virtual void destroy() in the base class
The subclass has void destroy() in the header and void Socket::destroy() in the .cc file
 
yes
 
but only the virtual from the baseclass gets called
 
how are you instantiating the class?
 
3:19 PM
Socket *socket = new Socket(string(*host), ToInt32(args[1]));
 
Is socket the base or derived?
 
derived
The whole thing is a work around :/
 
so how can base destroy be called? if you explicitly instantiate a derived object?
 
I've got V8 doing a callback on a static function of my WrapperBaseClass
now it need to somehow call the derived classes cleanup method
Callback->~Wrapper: this->destroy()
 
why you explicitly calling a destructor?
 
3:22 PM
well I do delete "obj" inside the static callback
static void collect(Persistent<Value> value, void *data) {
    WrappedClass *cls = static_cast<WrappedClass*>(data);
    delete cls;
}
 
so wrappedclass is your base?
 
this get's called when V8 collects the JavaScript object which wraps the instance
Yes
 
but I don't get how your Socket->Destroy can call its base when it is a Socket... that does not make any sense
it should only call the Socket Destroy
 
that's what he's trying to figure out
 
maybe inside the destructor of the wrapped class the inheritance gets screwed up?
 
3:24 PM
Hi Ivo. I think that is the problem
 
I can't cast it to Socket
 
is your destructor virtual?
 
because I don't know the type of the thing inside the static callback
@Tony tried it both with virtual and non virtual
 
oh ok
 
If you have class A and derived class B, and you make a B the construction order is A then B. If you destruct the destruction order is B then A.
 
3:25 PM
if I could make the V8 call accept a template...
 
Perhaps your virtual function no longer exists to be called at that point
 
@Ivo: you should probably post this as a question on SO. This is the chat room, where we talk mostly about pizza.
 
@JohnDibling Don't make me hungry :O
 
...And try to find ways to bribe litb in to emailing his thesis around :)
 
@JohnDibling lol yea Pizza objects and their derivatives
 
3:28 PM
Hm when defining the destructor on Socket the linker complains undefined reference to `vtable for Socket'
 
that explains... no vtbl your virtual functions can't work
 
And when removing the destructor from the Wrapper in hope that the code above then calls the derived one glib explodes with bad ptr
I admit I'm not a C++ guru
 
me neither
 
I got that no vtable error when using gcc with Qt sometimes. Doing a full clean and restarting Qt would fix it...
 
That works, it successfully destructs the base and the derived one
my code looks the same but yet it doesn't work
 
3:33 PM
Are you calling dispose on a handle like that? Or on the class itself
handle_.Dispose();
 
I don't even get to the point where I could call that
handle_ is the V8 JS object
also, this only needs to be called when I destroy the class from C++ side
When the callback gets called V8 has already gc'd the thing, I only need to get rid of the C++ part
ahhhhh
I got it to work
template <class T>
static void destroy(T* cls) {
    cout << "blaaa" << endl;
    cls->destroy();
}

static void collect(Persistent<Value> value, void *data) {
    WrappedClass *cls = static_cast<WrappedClass*>(data);
    cout << "foo" << endl;
    WrappedClass::destroy(cls);
}
static destroy casts the thing to the correct class and then calls it's destroy function et voila
what a mess
well at least I've got a working wrapper now
And that all just because html5 canvas is sooooooooo slow
 
4:31 PM
ok... so if I declare an class function as inline void myClass::myFunction(){ return;} does it HAVE to be in the header file... because I moved my inline functions to make the header neater, as well as doing other things... and now I am getting link errors. Just want to rule out this as a cause
 
No, it doesnt have to be
 
dam... that means I have done something else to break my code :(
 
sbi
@John That's wrong! If @thecoshman declares the function inline, it has to be in the header.
inline void myClass::myFunction(){ return;}
 
@sbi sigh.... copy and paster them back then... the link errors did sound like that was what was wrong
 
@sbi See edit 1 :P :P (Still working?)
 
4:41 PM
building...
win! thanks @sbi
 
4:52 PM
@sbi: oh, yes, of course.
wait, what?
where am i?
 
@JohnDibling fairly sure where ever you are... you'r near a computer. so if you stay their, and we turn of the power in every country we can narrow it down slowly but surely
 
Ok, go!
 
hang on... still looking for the switches
I am sure they must be fairly big...
wait a minute...
 
Probably red
 
may be I shouldn't find you...
maybe this is one of those test ¬_¬
 
4:58 PM
I might be from the Government...
 
L \
-| |
L /
 
just waiting for you to touch that switch
 
oh found one
wait no... that's just a squished baby bel
that... erm... got real big?
 
user502230
how can someone print time in each time std::cout is used
 
you could redirect the stream
to your own streambuffer which puts the time on the front of anything it receives
and then forwards it to the normal one
 
sbi
@CiscoIPPhone The problem with this is the fuzzy definition of "each time std::cout is used". What does that mean? Each time any << operator is invoked? Each line? Each time the buffer is flushed?
@Fallen You will first have to proper define what you want, then we could look at it.
@Fallen Oh, and:
2 hours ago, by sbi
@fahad This is the chat. Currently it has four active contributers, and that includes you. Post your question on SO. There's thousands of people out there looking at it within a few hours. If you want, post a link to here.
 
user502230
for example when i use:
 
sbi
Yeah?
 
user502230
5:21 PM
std::cout << "something" << std::endl;
it should print time before "something"
 
user502230
sry for double post
 
sbi
And when you do std::cout << something << "\n" << otherthing << std::endl << "blah";??
As I said, you need to properly define your requirement first.
 
user502230
then it should print before the "something" variable
 
user502230
you get me? i keep timeouting from this chat.
 
sbi
So define a function std::string getTimeStamp() and insert its result into the stream: std::cout << getTimeStamp() << "something" << std::endl;. Where's the problem?
 
user502230
5:27 PM
no, i don't mean like this, i mean without calling the function before the string to print out in the console, i mean it should does it alone, is that possible?
 
I love it you fix one bug, and then everything segfaults...
 
user502230
lol
 
maybe #define timeout (std::cout << getTimeStamp())
timeout << "testing" << std::endl;
 
sbi
@CiscoIPPhone Ugh. Why a macro? An inline function would be better.
@Fallen So you don't want to have to insert a function call manually. What else is off? Can you use a different stream that std::cout?
 
user502230
maybe
 
sbi
5:41 PM
@Fallen Maybe? Well, then maybe there's a solution for you.
 
user502230
wat solution? :/
 
sbi
That depends on the maybe.
 
user502230
i meant yes maybe on a different stream than std::cout
 
put it into the vector and you never get it out again -.-
 
user502230
wat?
 
5:44 PM
my v8 stuff here
socket->sendQueue.push_back((Persistent<String>)args[0]->ToString());
Hello World in
Persistent<String> data = sendQueue.at(i);
8123123 out
 
oh yeah an inline function would be better, a macro was just the first thing that came to mind, not that I use them often.
 
uhhhhh v8... I kill you
 
sbi
@Fallen I'm at work. I want to go home. I don't have the time to pull the requirements out of you one by one. So, one last time: Describe your requirements. Exactly. Maybe even instead of asking how to do X (because I want to achieve Y, of which I didn't tell you), rather tell us about Y. The best idea would be to post this on SO. Then, maybe someone has an idea how to do what you want.
 
Duuuuuude!
What happens to that stuff inside the vector :(
 
6:01 PM
is (Persistent<String>)args[0]->ToString() doing what you think it is? Try splitting it into separate statements and debugging
 
it does
Handle<Value> Socket::send(const Arguments& args) {
    Socket *socket = WrappedClass::unwrap<Socket>(args.This());
    if (socket->status != 3 && args[0]->IsString()) {
        socket->sendQueue.push_back((Persistent<String>)args[0]->ToString());
        Persistent<String> data = socket->sendQueue.at(0);
        String::Utf8Value str(data);
        cout << *str << endl;
        return Boolean::New(true);

    } else {
        return Boolean::New(false);
    }
}
(that's static)
the cout here prints Hello World
void Socket::handle() {
    if ((status == 2 || status == 1) && socket.IsValid()) {
        HandleScope scope;

        // Send queued data
        if (status == 1) {

            // send every item, if one fails break and try again on the next frame
            for(unsigned int i = 0; i < sendQueue.size(); i++) {
                cout << "sending data " << i << endl;

                Persistent<String> data = sendQueue.at(i);
                String::Utf8Value str(data);
                cout << "got string " << *str << endl;
yet this fails
seems to return some address instead of the strings content
 
what is the type of sendQueue?
 
vector< Persistent<String> > sendQueue;
I have no clue what's going on here, V8 shouldn't screw around with the String, as I need to call Dispose() to make it gc'able
 
user69820
hurray
 
user69820
0
Q: twisted c++ code

napster #include< iostream.h> int main() { int i=7,j; j=(i++,++i,j++*i); cout <<j; return 0; } what will be output of the c++ code? Its my homework that my professor gave me.

 
6:06 PM
sending data 0
got string 80957228
-.-
something must have happened with that string
data->Utf8Length(); segfaults
 
if your first sendQueue.at works and your second doesn't I can only imagine something is happening between the calls that changes the contents...
 
no clue
data->ToString() works
so the object is still there
it segaults in v8
workaround... convert the v8String to a string?
or wstring?
it needs to be utf8
ah
seems typecasting only doesn't convert the thing
in v8
Persistent<String>::New
that did it
and there's the next problem
ah
of course sizeof(buffer) doesn't work
writing this thing is better than any C++ book
 
sbi
6:32 PM
@oraclecertifiedprofessional That's a dupe of Prasoon's article on sequence points. I wish you had said that earlier, I only now looked at it.
@all Can you please vote to close this:
-2
Q: twisted c++ code

napster #include< iostream.h> int main() { int i=7,j=i; j=(i++,++i,j++*i); cout <<j; return 0; } what will be output of the c++ code? Its my homework that my professor gave me.

 
6:44 PM
@sbi done
 
user69820
@sbi i'm pretty sure I posted it 1 min after it was asked. Do I need to flag it for moderation?
 
user69820
in future
 
sbi
@oraclecertifiedprofessional You posted it, yeah. But a comment would have been nice, why you posted it.
(I hadn't even looked at it then.)
 
user69820
@sbi I thought the "hurray" was enough
 
user69820
@sbi to be honest, I thought you would have caught this anyway. I was not operating on a help-the-moderators agenda, merely a mirthful one
 
6:49 PM
@sbi done
 
user69820
chuckles
 
3
A: twisted c++ code

CubbiIt sometimes helps to convince people who don't believe this is undefined by actually compiling the program with several compilers and observing the results: After fixing the iostream.h error, g++ 4.5.2 prints 64 CLang++ 2.8 prints 63 Sun C++ 5.8 prints 63 MSVC 2010 prints 64 (oh, and, re-wr...

i like this answer best!
 
brain fart! const MyClass* that is a pointer to an instance of MyClass that is constant right? rather then MyClass* const which is a pointer that can only point to an instance of MyClass that can change
 
@thecoshman const MyClass* is a pointer that can point both to const and to non-const objects of type MyClass, but that object cannot be changed via the pointer.
 
6:56 PM
@FredOverflow very precise that :D thanks. The type of pointer you want to return to let see data in your class, with the very mummy "look but don't touch"
 
int i = 42;
const int* p = &i;
std::cout << *p << std::endl;   // prints 42
++i;
std::cout << *p << std::endl;   // prints 43
@thecoshman Yes, although in most cases, I'd prefer a reference-to-const
for example const std::string& get_foo() const { return m_foo; }
 
as in returning const &MyClass
 
@thecoshman no, const MyClass& (or alternatively, MyClass const&, that's a matter of style and opinion, not of semantics)
 
00:00 - 19:0019:00 - 00:00

« first day (30 days earlier)      last day (4919 days later) »