problems with concatenating cout and cin.get()..

Pages: 12
Then you've got a conceptual error.
You evaluate cin.get() and obtain and integer, so you are just printing a number ¿why wouldn't be allowed?

I didn't say it wouldn't be allowed, just said I didn't know it was legal C++ as every example I have ever seen shows istreams and ostreams separate. I didn't know you could put istreams inside the ostreams.
I meant I didn't know you could have cin.get() in the same line as cout.


I guess it's easier to think of it this way: operators are masked function calls. And nobody stops you from calling a function as another function's argument.
printf("%d", five());

Example:
1
2
3
4
5
6
#include <iostream>

int main()
{
	operator<<(std::cout, "Hello Crazy World!").operator<<(std::endl);
}
C++ does not have the concept of sequence points.

Yes it does.

The latest standard changed the wording to remove all use of the phrase "sequence points", preferring instead to describe actions in terms of how individual operations are sequenced, like "sequenced before".

The idea is to try to make the concept easier to understand, and to word things in a way that easier facilitates playing with concurrency.

Either way, we are considering where it is known that an operation has completed all its side effects, and whether it is named as a "sequence point" or indicated with words like "before" and "after", it still exists -- and is critical to the function of the language.

[edit]
http://blogs.msdn.com/b/vcblog/archive/2007/06/04/update-on-the-c-0x-language-standard.aspx
Last edited on
I wish I had my chat logs on now. Was talking about this on IRC channel, asking about why I've never seen a warning or anything about cout<<(char)cin.get()<<(char)cin.get()<<(char)cin.get()<<endl; and some guy said "I'm sure Stroustrup would be turning over in his grave right now!" First time I ever saw a channel get flooded with *facepalm*. Made me laugh though.
So was that the only answer you have gotten?
Yeah, they became too busy chastising him for his folly.
Topic archived. No new replies allowed.
Pages: 12