L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 05:19 PM |
i dont understand this queston:
spot the object in this simple program
#include [iostream]
int main() { std::cout << "hello world"; return 0; }
what is the object? LOLOLOL |
|
|
| Report Abuse |
|
|
Tarabukka
|
  |
| Joined: 18 Jan 2011 |
| Total Posts: 394 |
|
|
| 15 Aug 2012 05:20 PM |
| std::cout is a static std::ostream, correct? |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2012 05:21 PM |
... Your code is wrong. Also, this is still spamming. Stop being annoying. |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 05:31 PM |
thanks for ruining it for everyone Tarabukka.
and would you like to explain what a stream is? |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 05:32 PM |
| what's wrong with it chicken? huH? whats wrong with it? |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 05:34 PM |
| Tarabukka, std::cout is an object of class std::ostream (std being the standard namespace) |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2012 05:37 PM |
What is wrong? You are being a jerk. I thought you posted this just to post it. Anyway, I have a problem with [] instead of <>. Also not you are not using using namespace std. :P It is just a personal preference. |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 05:46 PM |
| you could have name conflictions with 'using namspace blah;', which is why i use the std prefix. and i use <> but roblox wont allow it. |
|
|
| Report Abuse |
|
|
|
| 15 Aug 2012 06:02 PM |
"Thanks for ruining it for everyone, Tarabukka"
Why are you mad if someone answered your question? |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 06:08 PM |
| he didnt answer correctly, it wa a joke nincompoop. >_> |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 06:09 PM |
| and stop changing what I said; you are making it look like i actually have grammar. |
|
|
| Report Abuse |
|
|
NB3
|
  |
| Joined: 27 Dec 2009 |
| Total Posts: 537 |
|
|
| 15 Aug 2012 06:16 PM |
| Temper doesn't get your way. |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 15 Aug 2012 06:21 PM |
@whoever said it
Using "using" is really bad practice... At the very most do: using std::cout; Namespaces can conflict |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
| |
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 06:22 PM |
I JUST TOLD YOU THAT TODAY ABOY.
> "using std::cout;" That's a 'using declaration'. |
|
|
| Report Abuse |
|
|
NB3
|
  |
| Joined: 27 Dec 2009 |
| Total Posts: 537 |
|
| |
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 15 Aug 2012 06:26 PM |
@gabe
Unshun. But you don't use a namespace. If you still want to be lazy without making catastrophic things happen, using std::cout/cin/whatever; is the next best thing. If you want to be a 1337 programmer, just use std::cout << "printing stuff hur"; all the time. But laziness is OP. Also, you never told me that. You just flamed me when I used the namespace in my ridiculous "Hello, world!" example. You won't be shot if you have "using" in your program... Reshun. |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 06:26 PM |
| he completly took what i told him he was doing wrong, and told it somebody else. im the one who corrected him on that and he just went off and told somebody else the same thing. >_> |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 06:28 PM |
| yes, use a using declaration, like i said before. and I'm not using a namespace? what? im using the standard namespace. |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 15 Aug 2012 06:35 PM |
You are getting so picky about something that legitimately does not matter... There is such a minute chance that you have clashing header files T_T
Would you prefer this:
void Example(std::ostream& out = cout){ out << "Better n0b?"; }
Because realistically that's the best and you have no chance of conflict because everything is kept within the scope of the function. Now stop arguing about "proper C-coding". People really do not complain about something as insignificant as that. If you're screwing with namespaces in the header, you may run into an issue. However, for the most part this *will not happen* **ever**. So just let it go. |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 06:36 PM |
> " If you want to be a 1337 programmer, just use std::cout << "printing stuff hur";"
what are you, 12? programming is programming, other people have diferent ways to do things. one just happens to be more logical in my case.
> "You just flamed me when I used the namespace in my ridiculous "Hello, world!" example."
you were calling me an idiot. *facepalm*
> "You won't be shot if you have "using" in your program... Reshun."
no, but your co-workers won't be happy
> "If you still want to be lazy without making catastrophic things happen, using std::cout/cin/whatever; is the next best thing. "
can still have conflicitons with other namespaces
|
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 15 Aug 2012 06:39 PM |
| WTF is anyone doing messing with std in the global namespace anyway?! Just don't muck around with std in the global namespace and you won't affect it at all. Also, I don't work for a company to program C++ so my coding style really only matters to me in that it has to work... GOBWEY, you're nothing but pessimism T_T |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 06:41 PM |
| okay, you dont get it, i'll write example now. |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 15 Aug 2012 06:48 PM |
| I'm seriously awaiting your example for when "using std::cout;" is ever going to conflict in any realistic situation. |
|
|
| Report Abuse |
|
|
L3GabeL4
|
  |
| Joined: 18 Feb 2012 |
| Total Posts: 808 |
|
|
| 15 Aug 2012 06:52 PM |
not for the standard namespace. somethings like
using namespace foo; using namespace bar;
and both of those namespaces had a class called "foobar".. this class both overloaded the insertion operator.
std::cout << foobar << std::endl;
then the compiler would be like WTF?! and you would have problems.
get what i mean now? hmmm? |
|
|
| Report Abuse |
|
|