Re: Question about genassym, locore.s and 0-sized arrays(showstopper for an icc compiled kernel)

From: Alexander Leidinger <Alexander_at_Leidinger.net>
Date: Sat, 6 Sep 2003 10:33:34 +0200
On Fri, 5 Sep 2003 09:55:57 -0700
Marcel Moolenaar <marcel_at_xcllnt.net> wrote:

> Interesting, What does icc do with:
> 
> struct {
> 	int tag;
> 	char obj[];
> } foo;
> 
> And what does the sizeof() operator give.

---snip---
% <marcel.c 
#include <stdio.h>

struct {
        int tag;
        char obj[];
} foo;

int main(void) {
        struct foo bar;

        printf("%d\n", sizeof(struct foo));
        printf("%d\n", sizeof(bar));
        return 0;
}


% icc marcel.c
marcel.c(9): error: incomplete type is not allowed
        struct foo bar;
                   ^

marcel.c(11): warning #70: incomplete type is not allowed
        printf("%d\n", sizeof(struct foo));
                              ^

compilation aborted for marcel.c (code 2)

% <marcel.c  
#include <stdio.h>

struct {
        int tag;
        char obj[];
} foo;

int main(void) {
        printf("%d\n", sizeof(struct foo));
        return 0;
}

% icc marcel.c
marcel.c(9): warning #70: incomplete type is not allowed
        printf("%d\n", sizeof(struct foo));
                              ^
% ./a.out     
0
---snip---

Bye,
Alexander.

-- 
                      Loose bits sink chips.

http://www.Leidinger.net                       Alexander _at_ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7
Received on Fri Sep 05 2003 - 23:32:19 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:21 UTC