ssercpp12 / Homework

Homework result for 12 sser cpp
1 stars 8 forks source link

about code style #8

Closed fuyang940705 closed 11 years ago

fuyang940705 commented 11 years ago

why #include and #include show shat “Streams are highly discouraged. ”

and at the bigining“file_interface_impl.cpp:0: No copyright message found. You should have a line: "Copyright [year] " ”

and using namespace show : Do not use namespace using-directives. Use using-declarations instead. 是说不要直接using命名空间么?

最后说:One or more unexpected \r (^M) found;better to use only a \n 。。怎么改?

omegaga commented 11 years ago
  1. did you write your code in Windows? In Windows a line break is expressed as \r\n, but in Unix-like operating system, it is \n. In most cases, a single \n is enough for most editors(notepad in Windows is a exception) to recognize a line break, and in some editors(like vim) a \r will be shown as ^M. Usually, this will not affect correctness of your code, but a \n is better.
  2. using namespace is discouraged since you have no idea what names you are importing, even with the standard library, which might leads to unexpected errors. If you are in a ACM/ICPC contest, you don't have to care about it. But in real world, you do.
  3. streams have many cons. this link tells you why.