Storage size of 'oldact 'isn' t known

Source: Internet
Author: User
#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 funze 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 wocould be grateful if somebody cocould point me to a good overview describing what standards compliance means for various OS/compiler + options/standards
Combinations.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.