On Sun, Dec 03, 2000 at 02:38:40AM -0800, Greg Stein wrote:
> On Sun, Dec 03, 2000 at 02:59:03AM -0600, Sam TH wrote:
> > Now, the real problem. The following code won't be accepted by the MetroWorks compiler:
> >
> > ### mwcc Compiler Error:
> > # svn_string_t data = { (char *)buf, len, len, fc->pool };
> > # ^
> > # illegal constant expression
> > #----------------------------------------------------------
> > File "/boot/home/subversion/subversion/libsvn_ra_dav/fetch.c"; Line 354
> > #----------------------------------------------------------
> >
> > The problem appears to be not being able to use variables in this sort of structure initalization.
>
> The above code is "supposed" to be legal. However, I seem to recall the
> HP/UX compiler having an issue with it, too (saw it with a mod_dav report a
> long while back).
>
> I can fix it up, and we probably should throughout the code, since I think
> you won't be the only person to run into it. Please report them whenever you
> smack into them, and we'll get it patched up.
Ok. Will do.
>
> > For example, the following code won't compile either:
> >
> > typedef struct {char *a; char *b;} mystruct;
> >
> > void foo(char * a, char * b)
> > {
> > mystruct = {a, b}
> > }
>
> The above code is not legal. You can only do structure initialization at
> declaration time.
There are worse problems than that with that line. :-)
That's what I get for having deleted the code by the time I wrote the
email. The actual line was:
mystruct baz = {a, b};
which should be legal and equivalent to the above case.
sam th
sam@uchicago.edu
http://www.abisource.com/~sam/
GnuPG Key:
http://www.abisource.com/~sam/key
- application/pgp-signature attachment: stored
Received on Sat Oct 21 14:36:16 2006