It's impossible to answer this question without knowing the target platform. The C standard doesn't specify this stuff but it is usually specified by an ABI (application binary interface) so that code produced by different C compilers interoperates correctly. On Linux-x86_64, both gcc and tcc give 16 for this program.

On 18/06/13 08:24, Ariset Llerena wrote:
the following code

#include <stdint.h>
#include <stdio.h>
struct foobar{
    uint16_t foo; // 4 bytes
    uint64_t bar; // 8 bytes
};
int main(){
    printf("%d\n", sizeof(struct foobar));
    return 0;
}

prints 16, gcc 4.7 prints 12 that is the correct result. Posted in http://ideone.com/grqlpU

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to