Britton <[EMAIL PROTECTED]> writes:
> > > Replaceing the strlen call with a call of an impure function
> > > (commented out above) results in the above error whether or not -O is
> > > used. It seems to me that pure function should either always be
> > > usable in this way regardless of -O (and C
> > It can only do that because it knows strlen is pure, thats the point
> > of pureness.
>
> That alone wouldn't suffice, the value has to be known at compile
> time.
>
> > If the standard says constant only, gcc should choke on strlen()
> > with or without optimization.
>
> Correct. Currently, i
On 3 Jan 2004, Falk Hueffner wrote:
> Britton Leo Kerin <[EMAIL PROTECTED]> writes:
>
> > static char *const foo = "baz";
> > static int foo_len = strlen(foo);
> > /* static int foo_len = an_impure_function(); */
>
> > greenwood$ gcc test_const.c
> > test_const.c: In function `main':
> > te
Britton Leo Kerin <[EMAIL PROTECTED]> writes:
> static char *const foo = "baz";
> static int foo_len = strlen(foo);
> /* static int foo_len = an_impure_function(); */
> greenwood$ gcc test_const.c
> test_const.c: In function `main':
> test_const.c:14: error: initializer element is not const
Package: gcc-3.3
Version: 1:3.3.3-0pre1
Severity: normal
This program:
#include
#include
#include
int an_impure_function(void)
{
return rand();
}
int main(void)
{
static char *const foo = "baz";
static int foo_len = strlen(foo);
/* static int foo_len = an_impure_function(); */
pr
5 matches
Mail list logo