lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] [bug #3031] Implement a new fully pool-basedpbufimpleme


From: Thomas Mueller
Subject: Re: [lwip-devel] [bug #3031] Implement a new fully pool-basedpbufimplementation.
Date: Thu, 26 Jul 2007 09:12:10 +0200

On Wed, 25 Jul 2007 12:17:09 -0700, Grubb, Jared wrote:
> I haven't compiled it, but doesn't this do it:
> 
> #define pbuf_clen(p, len) \
> { \
>   struct pbuf *q = (p); \
>   (len) = 0; \
>   while (q != NULL) { \
>     ++(len); \
>     q = q->next; \
>   }\
>   len    // no semicolon!
> }

GNU-C allows statements and declarations inside expressions like this:
 ({ int y = foo(); int z;
    if (y > 0) z = y;
    else z = - y;
    z; })

It is a GNU-C extension and not portable.

-- 
Thomas Mueller




reply via email to

[Prev in Thread] Current Thread [Next in Thread]