[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

auto struct init (was: Re: BeOS PPC Compilation Fixes)

From: Greg Stein <gstein_at_lyra.org>
Date: 2000-12-03 11:38:40 CET

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.

> 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.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:16 2006

This is an archived mail posted to the Subversion Dev mailing list.