This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: typeof and bitfields
Alexandre Oliva <aoliva@redhat.com> writes:
| On Jan 14, 2005, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
|
| > That is an argument for not returning an int. It is not an argument
| > for issueing error. Why not return int_with_2bits?
|
| Let's see...
Let's see
typedef int T(int);
struct A {
T f;
};
is A::f a member function, even though it is not declared with the
(member) function notation?
| struct x {
| unsigned int i:2;
| } *p;
|
| typedef __typeof(p->i) BF;
|
| struct y {
| BF j;
| BF k:14;
| } *q;
|
| int main() {
| __typeof(q->j) m = 7;
| }
|
| What do you expect to get from this piece of code?
What do you expect from
int main() {
struct X {
unsigned j : 2;
};
X x = { 7 };
}
| Is y::j a bit-field, even though it's not declared with the bit-field
| notation?
Why not?
| Is the declaration of y::k valid?
Why would it be?
| What is the size of struct y?
we've got an error on k.
| Do j
| and k pack into a single unsigned int?
we can't pack things that do not exist.
| Heck, is the declaration of BF valid?
Yes, why not?
| What if you use BF to declare a global variable, or a function argument?
What if you delcare a global variable or a function parameter like this
unsigned int x : 2;
?
-- Gaby