This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problem building vector/reim_source.c


On Mon, Aug 20, 2001 at 12:25:41PM +0100, Brian Gough wrote:
> gsl-discuss@lists.thewrittenword.com writes:
>  > I've opened a problem report with Sun and gave them a small test case
>  > to reproduce the bug. I'll forward your info below if they need
>  > convincing.
> 
> Sounds good.  You probably saw it on comp.std.c but just for reference
> this was the simplest test case I could find:

According to the Sun engineer:
  I don't think that's valid C code.

  I don't think you can initialize a variable in C with the value of a
  function call like that.

This is using your C code below. Can you point me at the section in
C89 that says the code below should work?

> ----------------------------------------------------------------------
> $ cat test.c
> #include <stdio.h>
> 
> typedef struct {
>   int k;
>   const int kmax;
> } A;
> 
> A create_A (void)
> {
>   A a = { 1, 2 };
>   return a ;
> }
> 
> int main (void)
> {
>   A a = create_A ();
>   printf("a.k=%d\n", a.k);
>   printf("a.kmax=%d\n", a.kmax);
>   return 0;
> }
> 
> $ gcc -ansi -pedantic -Wall -O2 test.c    # gcc-2.7.2.3 and gcc-3.0
> $ ./a.out
> a.k=1
> a.kmax=2
> 
> $ cc -V test.c
> cc: Sun WorkShop 6 update 1 C 5.2 2000/09/11
> acomp: Sun WorkShop 6 update 1 C 5.2 2000/09/11
> "test.c", line 11: left operand must be modifiable lvalue: op "="
> "test.c", line 16: left operand must be modifiable lvalue: op "="
> cc: acomp failed for test.c
> 
> ----------------------------------------------------------------------

-- 
albert chin (china@thewrittenword.com)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]