Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Sep 2003 10:33:34 +0200
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        current@freebsd.org
Subject:   Re: Question about genassym, locore.s and 0-sized arrays(showstopper for  an icc compiled kernel)
Message-ID:  <20030906103334.0f3233aa.Alexander@Leidinger.net>
In-Reply-To: <20030905165557.GB566@dhcp01.pn.xcllnt.net>
References:  <20030904180448.021a1b6b.Alexander@Leidinger.net> <20030904162858.GI98381@dan.emsphone.com> <20030905001411.3a9030b3.Alexander@Leidinger.net> <20030904225123.GB39916@dan.emsphone.com> <3F584B85.AAC3A11D@mindspring.com> <20030905105507.51ba3183.Alexander@Leidinger.net> <20030905165557.GB566@dhcp01.pn.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 5 Sep 2003 09:55:57 -0700
Marcel Moolenaar <marcel@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 @ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030906103334.0f3233aa.Alexander>