C
Chris Stankevitz
Hello,
Is there a good reason that the code below is illegal?
a) No. It's an artifact of some other situation and you get to bear
the pain by having your cute one-liner rendered illegal
b) Yes. That code could cause a segfault on hardware due to
assumptions that the compiler makes about things that are too
complicated for you to understand.
c) Well if you don't like it why don't you create your own programming
language you lazy leech.
d) This is not the correct forum for this question, now scram before I
have to get snooty.
e) [your answer here]
I'm leaning toward (a).
Thank you,
Chris
//===
#include <iostream>
#include <sstream>
void PrintValues(std::istream& Stream)
{
std::string String;
while (Stream >> String)
{
std::cout << String << std::endl;
}
}
int main()
{
PrintValues(std::istringstream("Hello, world!"));
return 0;
}
Is there a good reason that the code below is illegal?
a) No. It's an artifact of some other situation and you get to bear
the pain by having your cute one-liner rendered illegal
b) Yes. That code could cause a segfault on hardware due to
assumptions that the compiler makes about things that are too
complicated for you to understand.
c) Well if you don't like it why don't you create your own programming
language you lazy leech.
d) This is not the correct forum for this question, now scram before I
have to get snooty.
e) [your answer here]
I'm leaning toward (a).
Thank you,
Chris
//===
#include <iostream>
#include <sstream>
void PrintValues(std::istream& Stream)
{
std::string String;
while (Stream >> String)
{
std::cout << String << std::endl;
}
}
int main()
{
PrintValues(std::istringstream("Hello, world!"));
return 0;
}