* [Bug c/15240] sizeof() doesn't work on struct fields
2004-05-01 11:32 [Bug c/15240] New: sizeof() doesn't work on struct fields d dot yu dot bolkhovityanov at inp dot nsk dot su
@ 2004-05-01 11:51 ` falk at debian dot org
2004-05-01 12:03 ` d dot yu dot bolkhovityanov at inp dot nsk dot su
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: falk at debian dot org @ 2004-05-01 11:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2004-05-01 11:51 -------
sizeof works for expressions, or for parenthized types. "(s_t.x)" is neither,
so it's not supposed to work.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15240
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/15240] sizeof() doesn't work on struct fields
2004-05-01 11:32 [Bug c/15240] New: sizeof() doesn't work on struct fields d dot yu dot bolkhovityanov at inp dot nsk dot su
2004-05-01 11:51 ` [Bug c/15240] " falk at debian dot org
@ 2004-05-01 12:03 ` d dot yu dot bolkhovityanov at inp dot nsk dot su
2004-05-01 12:06 ` falk at debian dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: d dot yu dot bolkhovityanov at inp dot nsk dot su @ 2004-05-01 12:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From d dot yu dot bolkhovityanov at inp dot nsk dot su 2004-05-01 12:03 -------
So, to paraphrase your answer, gcc does what the standard dictates, and it's the
C standard which is in fault, right?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15240
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/15240] sizeof() doesn't work on struct fields
2004-05-01 11:32 [Bug c/15240] New: sizeof() doesn't work on struct fields d dot yu dot bolkhovityanov at inp dot nsk dot su
2004-05-01 11:51 ` [Bug c/15240] " falk at debian dot org
2004-05-01 12:03 ` d dot yu dot bolkhovityanov at inp dot nsk dot su
@ 2004-05-01 12:06 ` falk at debian dot org
2004-05-01 12:25 ` schwab at suse dot de
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: falk at debian dot org @ 2004-05-01 12:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2004-05-01 12:06 -------
(In reply to comment #2)
> So, to paraphrase your answer, gcc does what the standard dictates, and it's the
> C standard which is in fault, right?
Yes.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15240
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/15240] sizeof() doesn't work on struct fields
2004-05-01 11:32 [Bug c/15240] New: sizeof() doesn't work on struct fields d dot yu dot bolkhovityanov at inp dot nsk dot su
` (2 preceding siblings ...)
2004-05-01 12:06 ` falk at debian dot org
@ 2004-05-01 12:25 ` schwab at suse dot de
2004-05-02 7:39 ` d dot yu dot bolkhovityanov at inp dot nsk dot su
2004-05-03 3:40 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: schwab at suse dot de @ 2004-05-01 12:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schwab at suse dot de 2004-05-01 12:25 -------
(In reply to comment #2)
> So, to paraphrase your answer, gcc does what the standard dictates,
Yes.
> and it's the C standard which is in fault, right?
No.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15240
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/15240] sizeof() doesn't work on struct fields
2004-05-01 11:32 [Bug c/15240] New: sizeof() doesn't work on struct fields d dot yu dot bolkhovityanov at inp dot nsk dot su
` (3 preceding siblings ...)
2004-05-01 12:25 ` schwab at suse dot de
@ 2004-05-02 7:39 ` d dot yu dot bolkhovityanov at inp dot nsk dot su
2004-05-03 3:40 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: d dot yu dot bolkhovityanov at inp dot nsk dot su @ 2004-05-02 7:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From d dot yu dot bolkhovityanov at inp dot nsk dot su 2004-05-02 07:39 -------
> > and it's the C standard which is in fault, right?
>
> No.
Andreas, sorry for taking your time, but can you please point me to some C
standard docs (discussion?) stating WHY such a reasonable behaviour is not allowed?
(The only constraint in the C99 standard (6.5.3.4) is "The sizeof operator shall
not be applied to an expression that has function type or an incomplete type, to
the parenthesized name of such a type, or to an expression that designates a
bit-field member." But "struct_type_name.field_name" falls outside of that
constraint.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15240
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/15240] sizeof() doesn't work on struct fields
2004-05-01 11:32 [Bug c/15240] New: sizeof() doesn't work on struct fields d dot yu dot bolkhovityanov at inp dot nsk dot su
` (4 preceding siblings ...)
2004-05-02 7:39 ` d dot yu dot bolkhovityanov at inp dot nsk dot su
@ 2004-05-03 3:40 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-05-03 3:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-05-03 03:40 -------
One possible answer is that contrary to Java, in C and C++ you cannot
access members of _types_ using type.member. If anything, then this should
be type::member (in C++), which would fail in your case since the
member is non-static, though. The dot-operator can only be used to
access members of _variables_, not _types_.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15240
^ permalink raw reply [flat|nested] 7+ messages in thread