Kazu Hirata wrote:
Hi,
I have two questions about the C++ front end.
Consider a C++ program
static const int array[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2 };
int
foo (int a)
{
return array[7];
}
I am trying to fold array[7] into 2. It turns out that if T is an
ARRAY_REF,
TREE_READONLY (TREE_OPERAND
Mark Mitchell writes:
Kazu Hirata wrote:
...
static const int array[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2 };
int
foo (int a)
{
return array[7];
}
I am trying to fold array[7] into 2. It turns out that if T is an
ARRAY_REF,
TREE_READONLY (TREE_OPERAND (T, 0))
is 0. Why? This
Paul Schlie wrote:
- ??? no such thing, you can't dynamically initialize a static const,
as then it's not a static const, but rather simply a global const
(as a static const object is logically equivalent to a named/addressable
literal, yes?)
No, it's not.
static const int i = f();
--
Mark
From: Mark Mitchell [EMAIL PROTECTED]
Paul Schlie wrote:
- ??? no such thing, you can't dynamically initialize a static const,
as then it's not a static const, but rather simply a global const
(as a static const object is logically equivalent to a named/addressable
literal, yes?)
From: Paul Schlie [EMAIL PROTECTED]
From: Mark Mitchell [EMAIL PROTECTED]
Paul Schlie wrote:
- ??? no such thing, you can't dynamically initialize a static const,
as then it's not a static const, but rather simply a global const
(as a static const object is logically equivalent to a
Hi Mark,
That's a bug, or, rather, a place where the C++ front-end is failing
to give full information to the optimizer. It should be
TREE_READONLY. There are some tricky bits, in that if we're doing a
dynamic initialization, we presently cannot mark it TREE_READONLY,
but this is a static
On Sunday 08 May 2005 06:11, Kazu Hirata wrote:
I created an array with more than one thousand elements. I still did
not see a RANGE_EXPR in the array's CONSTRUCTOR. How do I get a
RANGE_EXPR in a CONSTRUCTOR?
IIRC G++ only builds RANGE_EXPRs for all-zero constructors.
Gr.
Steven
Kazu Hirata schrieb:
I am trying to fold array[7] into 2. It turns out that if T is an
ARRAY_REF,
TREE_READONLY (TREE_OPERAND (T, 0))
is 0. Why?
I don't know anything about fold but in general a c++ array in the
frontend is cv-qualified, not its elements.
Another question. How is a
Hi Nathan,
this is untrue. the elements hold the qualification.
Then how do I know that an array is declared with const (or static
const)? When I looked at the CONSTRUCTOR stored in the DECL_INITIAL
of an array, I saw it with the TREE_STATIC flag set regardless of
whether the array is declared
Kazu,
Then how do I know that an array is declared with const (or static
const)? When I looked at the CONSTRUCTOR stored in the DECL_INITIAL
of an array, I saw it with the TREE_STATIC flag set regardless of
whether the array is declared with const, so that's not useful to
determine whether
On Sunday 08 May 2005 16:47, Nathan Sidwell wrote:
Kazu,
Then how do I know that an array is declared with const (or static
const)? When I looked at the CONSTRUCTOR stored in the DECL_INITIAL
of an array, I saw it with the TREE_STATIC flag set regardless of
whether the array is declared
Nathan Sidwell schrieb:
Stefan Strasser wrote:
I don't know anything about fold but in general a c++ array in the
frontend is cv-qualified, not its elements.
this is untrue. the elements hold the qualification.
right
I have been processing large source codes including STL, boost and
custom code
Kazu Hirata writes:
Nathan writes:
this is untrue. the elements hold the qualification.
Then how do I know that an array is declared with const (or static
const)? When I looked at the CONSTRUCTOR stored in the DECL_INITIAL
of an array, I saw it with the TREE_STATIC flag set regardless of
Hi,
I have two questions about the C++ front end.
Consider a C++ program
static const int array[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2 };
int
foo (int a)
{
return array[7];
}
I am trying to fold array[7] into 2. It turns out that if T is an
ARRAY_REF,
TREE_READONLY (TREE_OPERAND (T, 0))
is 0.
14 matches
Mail list logo