开发者

C++ Stdlib IO Implementation details

  1. Are there any guarantees that C++ std IO will be portable across all Desktop and Mobile OS (I'm interested in iOS and Android)?
  2. Is implementation of std IO different across the platforms or it is rather uniform? If it is different, then does it happen due to SDK of the platform (in other words - do SDK's provide those different implementations)?
  3. Who provide those implementation? Who is the author? Does anybody update them?
  4. Where is documentation?
  5. 开发者_如何转开发


Are there any guarantees that C++ std IO will be portable across all Desktop and Mobile OS (I'm interested in iOS and Android)?

No, there are no guarantees that these platforms will implement, correctly at all the standard library.

Is implementation of std IO different across the platforms or it is rather uniform? If it is different, then does it happen due to SDK of the platform (in other words - do SDK's provide those different implementations)?

It's different. I/O is very different on different platforms.

Who provide those implementation? Who is the author? Does anybody update them? Where is documentation?

Either the compiler implementor or the platform owner provides them. The C++ Standard describes what the library must do.


I think you are failing to see the power of the standard libraries. They are designed to provide a common set of functionality that is available across any standards compliant compiler. For example, if I write the following code:

#include <iostream>

int main(int a, char** s)
{
  std::cout << "Hello World" << std::endl;
  return 0;
}

This will be compiled by any standards compliant compiler. You're getting hung up on, well the way std::cout works is different on each platform - yes of course it is. But this is the beauty of it - why do you have to care? On windows, if you compile this with MS Visual C++, that compiler will have the correct implementation (which the standard doesn't care about) to support the above standard way of writing to standard out. Similarly, on Linux GCC will have the correct code to write to whatever implementation, and on Solaris, CC will do the same.

You don't have to worry or frankly care. The handling for your platform is provided by the compiler that you are using for that platform. You have a nice clean high-level interface to work with.

Do you care how the Java VM handles the details of each platform? You don't, it's not your concern, you know when you do System.out.println() it will be written to the screen (or whatever for that VM) appropriately. SO why are you getting hung up on this?

The thing you have understand is whether the compiler that you are using on the specific platform will provide all the functionality in the standard library (i.e. is it fully standards compliant or not) and if not, what's missing and how to work around it. The rest is frankly irrelevant!

As for if you don't like it, well pay for something like Roguewave - which frankly is pissing money away, but it's your money to piss away...


Standard library is exactly that — standard. It's defined by standard. Every standard-compliant compiler must provide it. So the guarantee is that it will be portable across standard-compliant implementations (whether there's one for your target platform is a whole different question altogether). It has nothing to do with platform SDKs (whether it's implemented using one doesn't matter — the observable behaviour must be the same).


The idea of a standard (hence the std) is that it is respected and uniform no matter what platform you are on. Some developers ship devices with support for all or some of the std library, it's really just up to them how it is implemented.

This is platform specific and probably available in each platform's SDK documentation, available most probably with the SDK or on the vendor's website.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜