stream width and function files

Started by
2 comments, last by Zahlman 17 years, 6 months ago
To questions: 1. what does "width of a stream" mean? 2. in my book it declears the functions in a header file and it includes it in the main source file.. thats ok.. but it also tells me to put the definitions of the function in another source file.. how does the compiler know that this source files are beeing used in the main source file?
Advertisement
1 - I'm not sure what the width of a stream is without context, but if I were to guess, then I would say it is the size of the character type (you generally have two typedefs for char and wchar_t in the standard stream types, e.g. ifstream, wifstream).

2 - It doesn't. That's the point. The compiler does not need to know where the functions or defined or how they are implemented. That is the job of the linker. The linker links together all of the object files that were generated by the compiler. The compiler just need to know that these functions exist. For more information, see Organizing Code Files in C and C++.


jfl.
1. sorry, should have specified more.. its the member of a stream.. but what does it do? like s.width(n)

2. ok.. so aslong as the source file with the function definition's is compiled once the compiler will remember them whenever I want to use them? aslong as I include the head file in the programs I'm making?
Seriously, just RTFM on this one; it will be a lot less painful.

This topic is closed to new replies.

Advertisement