httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: [apreq-2] order of declarations
Date Wed, 23 Apr 2003 03:41:59 GMT
On Mon, 21 Apr 2003, Stas Bekman wrote:

> Randy Kobes wrote:
> > For apreq-2, VC++ on Win32 (but I think also some other
> > compilers) is picky about the order of declaring
> > variables in relation to assignments. This diff:
> > ================================================================
> > Index: apreq_parsers.c
> > ===================================================================
> > RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_parsers.c,v
> > retrieving revision 1.15
> > diff -u -r1.15 apreq_parsers.c
> > --- apreq_parsers.c	18 Apr 2003 20:15:50 -0000	1.15
> > +++ apreq_parsers.c	19 Apr 2003 19:25:16 -0000
> > @@ -751,10 +751,11 @@
> >  #define MFD_ERROR   -1
> >  
> >      if (parser->v.size == 0) {
> > -        const char *bdry, *ct = apreq_env_content_type(req->env);
> > +        const char *bdry, *ct;
> >          apr_size_t blen;
> >          apr_status_t s;
> >  
> > +        ct = apreq_env_content_type(req->env);
> >          memcpy(ctx->bdry, CRLF "--", 4);
> >  
> >          s = nextval(&ct, "boundary", &bdry, &blen);
> > ==================================================================
> > is needed to compile apreq_parsers.c.
> 
> Hmm, that's an unusual one. There are no declarations and standalone code 
> mixes here.
> 
> This, is indeed invalid:
> 
> int foo;
> foo = 1;
> int bar;
> 
> However this is absolutely valid:
> 
> int foo = 1;
> int bar;
> 
> So does this:
> 
> int tar, foo = 1;
> int bar;
> 
> Is there something special about the last one?

Welcome to VC++ :) There is something special about 
   const char *bdry, *ct = apreq_env_content_type(req->env);
   apr_size_t blen;
vs
   const char *bdry, *ct;
   apr_size_t blen;
   ct = apreq_env_content_type(req->env);
on VC++ - the 1st one complains about a missing ';', and then
gets confused that apr_size_t isn't being used as a declaration.
I'll look into this further, but I think it has something to
do with the way apreq_env_content_type() is defined - something
like
    float x, y=sin(z);
    int t;
is fine.

-- 
best regards,
randy


Mime
View raw message