[Top][All Lists]

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

[lwip-devel] [task #6933] Review usage of ASSERT and error handling with

From: Frédéric Bernon
Subject: [lwip-devel] [task #6933] Review usage of ASSERT and error handling with LWIP_NOASSERT
Date: Mon, 18 Jun 2007 07:48:59 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv: Gecko/20070515 Firefox/

Follow-up Comment #18, task #6933 (project lwip):

A question about some asserts I seen. Take this sample from pbuf_free:

  if (p == NULL) {
    LWIP_ASSERT("p != NULL", p != NULL);
    /* if assertions are disabled, proceed with debug output */
    LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE | 2, ("pbuf_free(p == NULL) was
    return 0;

1/ in this case, the assert test isn't useful: you already know that (p ==
NULL). Isn't it better to directly call LWIP_PLATFORM_ASSERT?

2/ Just to understand, why do you have move the assert inside the "if (p ==
NULL)" (it was just before in previous code)? After all, it does the same

3/ I would like to know why LWIP_ASSERT, LWIP_ERROR and LWIP_DEBUGF do the
job with a "do {...} while(0)" ? Why this do/while?


Reply to this item at:


  Message posté via/par Savannah

reply via email to

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