Is std::streampos guaranteed to be unsigned long long?

后端 未结 2 785
说谎
说谎 2020-12-16 21:19

Is std::streampos guaranteed to be unsigned long long?

If not so, how does std::istream::seekg work correctly on files larger

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-16 22:16

    No, it's not guaranteed to be unsigned long long.

    Especially with older compilers, it may not work with files larger than 4 GB (and in a few cases it was signed, so it only worked with files up to 2 GB--but when typical hard drives were 20 to 40 megabytes, that probably didn't seem like a major consideration).

提交回复
热议问题