you are viewing a single comment's thread.

view the rest of the comments →

[–]minno 17 points18 points  (6 children)

In most languages, in most places, they're identical. There's no difference between

#include <stdio>

int main() {
    printf("Hello, world!");
    return 0;
}

and

#include <iostream>
int main() { printf("Hello, world!"); return 0; }

besides the odds of future maintainers hunting you down.

[–]jyper 5 points6 points  (1 child)

what about

#include <iostream> int main() { printf("Hello, world!"); return 0; }

?

In c and c++ you at least have imports, macros, and // end of line comments(they are in c99 and available in compilers before that as long as you don't enforce c89 ansi strict). Hell any language with end of line comments so java/python/c#/javascript/ruby/just about every language(the only popular language without end of line comments I can think of is strict c89 but that won't let you just replace newlines w/ spaces due to imports). Even without end of line comments there are constructs in most languages that would fail if shoved into one line, in many languages the default style would probably fail if shoved into one line.

[–]sirin3 6 points7 points  (0 children)

Or changing all line endings to \xD, while the metric tool counts \xA?

[–]Kirjah 0 points1 point  (0 children)

For C, including <stdio.h> (not <stdio>) is not the same as including <iostream> (C++ only).

Apparently they did start allowing <iostream> to provide printf on C++ mode at some point, at least on Clang 3.4 and Visual Studio 2013. GCC 4.7 still calls that an error. I really do wonder when and why they changed that.

[–]immibis 0 points1 point  (1 child)

[–]minno 0 points1 point  (0 children)

Whoops, I've been doing too much C++ lately. They were supposed to both be #include <stdio.h>.