file stream tellg/tellp and gcc-4.6 is this a bug?

前端 未结 3 1351
不思量自难忘°
不思量自难忘° 2021-01-12 20:35

This code:

#include 
#include 
#include 
#include 

int main()
{   
    std::remove(\"test.txt\");         


        
3条回答
  •  庸人自扰
    2021-01-12 21:12

    I can confirm the difference. However, it is not a difference of the compiler, it is not a difference of the standard library headers, it is a difference of the linked shared library.

    It doesn't depend on the gcc version. It doesn't depend on architecture:

    t44:       ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
    t45:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
    t46:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
    

    The real difference seems to be

    • meerkat: libstdc++6 4.5.1-7ubuntu2
    • natty: libstdc++6 4.6.0-3~ppa1 (from here)

    On ubuntu meerkat

    $ uname -a
    Linux natty 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 i686 GNU/Linux
    $ for a in t4?; do ./$a; done
    1
    4 4
    4 4
    1
    4 4
    4 4
    1
    4 4
    4 4
    

    On ubuntu natty

    Linux natty 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
    sehe@natty:/mnt/jail/home/sehe$ for a in t4?; do ./$a; done
    1
    4 4
    -1 4
    1
    4 4
    -1 4
    1
    4 4
    -1 4
    

提交回复
热议问题