zoukankan      html  css  js  c++  java
  • storage size of ‘oldact’ isn’t known

    #include <signal.h> 

    int main()
    {
    struct sigaction act, oldact;
    return 0;
    }



    dies with the message


    testgcc4.c: In function ‘main’:
    testgcc4.c:6: error: storage size of ‘act’ isn’t known
    testgcc4.c:6: error: storage size of ‘oldact’ isn’t known


    if I use -std=c99 or --ansi?
    gcc testgcc4.c compiles without problem but adding -std=c99 or --ansi produces 
    the error message above (for any of gcc-3.4, gcc-4.0, gcc-4.1) but neither 

    icc nor gcc on FreeBSD has a problem with -std=c99 or --ansi

    Sumarry:

    use -std=gnu99 on linux if you need some C99 functions (e.g. strtof) but also want to use functions like sigaction and strtok_r

    gcc on linux is stricter than gcc on FreeBSD (or icc on either FreeBSD or linux) concerning standards.
    gcc -std=c99 on linux means: *only* recognize functions specified in the standard (no sigaction, no strtok_r etc)
    gcc -std=c99 on FreeBSD or icc -std=c99 on either FreeBSD or linux means recognize functions specified in the standard. This corresponds more or less to -std=gnu99 on linux

    PS. This trap seems to be quite common (e.g. discussions on debian-glibc about the "fact" that strtof is completely broken on linux). I would be grateful if somebody could point me to a good overview describing what standards compliance means for various OS/compiler+options/standards combinations.

    上面的代码使用-std=gnu99正常通过。

    man gnu:

    c99
    c9x
    iso9899:1999
    iso9899:199x
    ISO C99. Note that this standard is not yet fully supported; see <http://gcc.gnu.org/c99status.html> for
    more information. The names c9x and iso9899:199x are deprecated.

    gnu99
    gnu9x
    GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC, this will become the default. The name
    gnu9x is deprecated.

     参考 :http://blog.csdn.net/cccallen/article/details/8440175

  • 相关阅读:
    CSS 3D House
    图片聚光灯效果
    来玩玩用自己的英文名字算性格和运气
    关于Asp程序的Server.CreateObject错误解决方法
    CSS网页制作时实现自动换行的小技巧
    Oracle SQL FAQ
    有趣人物为你讲述网站开发过程
    用JavaScript绘图 ——JS2D函数集
    ASP操作Excel技术总结
    卡拉OK歌词同步播放
  • 原文地址:https://www.cnblogs.com/youxin/p/4042559.html
Copyright © 2011-2022 走看看