美文网首页
accelerated c++

accelerated c++

作者: onbug | 来源:发表于2018-10-25 20:31 被阅读0次

    Chapter 1 Working with strings

    There are three events that cause the system to flush the buffer. First, the buffer might be full, in which case the library will flush it automatically. Second, the library might be asked to read from the standard input stream. In that case, the library immediately flushes the output buffer without waiting for the buffer to become full. The third occasion for flushing the buffer is when we explicitly say to do so.

    Chapter 3

    Local variables of built-in type that are not explicitly initialized are undefined

    Chapter 4

    4.4

    It gives the compiler the opportunity to check for consistency between the declarations and the definitions. These checks are not exhaustive in most implementations, because complete checking requires seeing the entire program, but they are useful enough to make it worthwhile for source files to include the corresponding header files.
    The checking and its incompleteness stem from a common source: The language requires function declarations and definitions to match exactly in their result type, and in the number and types of parameters. This rule explains the implementation's ability to check—but why the incompleteness? The reason is that if a declaration and definition differ enough, the implementation can only assume that they describe two different versions of an overloaded function, and that the missing definition will appear elsewhere. For example, suppose we defined median as in §4.1.1/53, and we declared it incorrectly as int median (std::vector<double>); // return type should be double If the compiler sees this declaration when it compiles the definition, it will complain, because it knows that the return type of median(vector<double>) cannot simultaneously be double and int . Suppose, however, that instead we had declared double median (double); // argument type should be vector<double> Now the compiler can't complain, because median(double) could be defined elsewhere. If we call the function, then the implementation must eventually look for its definition. If it doesn't find the definition, it will complain at that point.

    相关文章

      网友评论

          本文标题:accelerated c++

          本文链接:https://www.haomeiwen.com/subject/hcpnzftx.html