Re: for (int i = expr; ....)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 22, 2008 at 08:26:30PM +0000, Chris Li wrote:
> On Thu, Feb 21, 2008 at 7:05 AM, Pierre Habouzit
> <pierre.habouzit@xxxxxxx> wrote:
> > Sparse doesn't support the C99 construct `for (int i = expr; ....)` properly.
> >  for example, the following C code:
> >
> >     #include <stdlib.h>
> >
> >     int main(void)
> >     {
> >         for (int i = atoi("12"); i < 10; i++);
> >         return 0;
> >     }
> >
> >  make sparse spit:
> >
> >     $ sparse -Wall test.c
> >     test.c:5:22: warning: call with no type!
> >
> >  In fact sparse doesn't support 'expr' to be a complex enough expression
> >  (expressions that can be folded work, but not any other afaict).
> 
> Nah, sparse supports expression in initializer all right.
> It just need to evaluate them to give it the correct ctype.
> 
> Please try the this one line patch I attached.

  Works for me, thanks.


-- 
·O·  Pierre Habouzit
··O                                                madcoder@xxxxxxxxxx
OOO                                                http://www.madism.org

Attachment: pgpwUWvtwfr3Y.pgp
Description: PGP signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux