From: gsl-discuss@lists.thewrittenword.com
To: gsl-discuss@sources.redhat.com
Subject: Re: Problem building vector/reim_source.c
Date: Wed, 19 Dec 2001 13:20:00 -0000 [thread overview]
Message-ID: <20010818210249.E80313@oolong.il.thewrittenword.com> (raw)
In-Reply-To: <20010818202423.D80313@oolong.il.thewrittenword.com>
On Sat, Aug 18, 2001 at 08:24:23PM -0500, gsl-discuss@lists.thewrittenword.com wrote:
> I don't think this is legal C89 code (from vector/reim_source.c):
>
> QUALIFIED_REAL_VIEW(gsl_vector, view)
> FUNCTION(gsl_vector, real) (QUALIFIED_TYPE(gsl_vector) * v)
> {
> REAL_TYPE(gsl_vector) s = NULL_VECTOR;
>
> s.data = v->data;
> s.size = v->size;
> s.stride = MULTIPLICITY * v->stride;
> s.block = 0; /* FIXME: should be v->block, but cannot point to
> block of different type */
> s.owner = 0;
>
> {
> QUALIFIED_REAL_VIEW(gsl_vector,view) view = NULL_VECTOR_VIEW;
> ((REAL_VIEW(gsl_vector,view) *)(&view))->vector = s;
> return view;
> }
> }
>
> The Solaris C compiler gives:
>
> cc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -mr -Qn -xstrconst -xO2
> -xtarget=generic -c reim.c -KPIC -DPIC -o reim.o
> "./reim_source.c", line 35: left operand must be modifiable lvalue: op "="
> "./reim_source.c", line 53: left operand must be modifiable lvalue: op "="
> "./reim_source.c", line 35: left operand must be modifiable lvalue: op "="
> "./reim_source.c", line 53: left operand must be modifiable lvalue: op "="
> "./reim_source.c", line 35: left operand must be modifiable lvalue: op "="
> "./reim_source.c", line 53: left operand must be modifiable lvalue: op "="
> cc: acomp failed for reim.c
>
> I don't believe you can cast an lvalue.
Ok, upon further investigation, the following code in vector/reim.c:
#define USE_QUALIFIER
#define QUALIFIER const
#define BASE_GSL_COMPLEX_LONG
#include "templates_on.h"
#include "reim_source.c"
#include "templates_off.h"
#undef BASE_GSL_COMPLEX_LONG
causes the chunk above in vector/reim_source.c to cpp to:
gsl_vector_long_double_const_view
gsl_vector_complex_long_double_const_real (
const gsl_vector_complex_long_double * v)
{
gsl_vector_long_double s = { 0 , 0 , 0 , 0 };
s.data = v->data;
s.size = v->size;
s.stride = 2 * v->stride;
s.block = 0;
s.owner = 0;
{
gsl_vector_long_double_const_view view = { { 0 , 0 , 0 , 0 } };
(( gsl_vector_long_double_view *)(&view))->vector = s;
return view;
}
}
So, the Solaris C compiler isn't allowing you to throw away the
const'ness of view (seems correct to me). I tried compiling with the
native compilers on Tru64 UNIX, IRIX, HP, and AIX and they all accept
the construct above.
--
albert chin (china@thewrittenword.com)
next prev parent reply other threads:[~2001-12-19 13:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-19 13:20 gsl-discuss
2001-12-19 13:20 ` gsl-discuss [this message]
2001-12-19 13:20 ` gsl-discuss
2001-12-19 13:20 ` Brian Gough
2001-12-19 13:20 ` gsl-discuss
2001-12-19 13:20 ` Brian Gough
2001-12-19 13:20 ` gsl-discuss
2001-12-19 13:20 ` Brian Gough
2001-12-19 13:20 ` gsl-discuss
2001-12-19 13:20 ` Brian Gough
2001-12-19 13:20 ` gsl-discuss
2001-12-19 13:20 ` Brian Gough
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010818210249.E80313@oolong.il.thewrittenword.com \
--to=gsl-discuss@lists.thewrittenword.com \
--cc=gsl-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).