This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bug in WDT firmware in SDK 16.0.0 ?

I am trying to use the NRFX_WDT design in SDK 16.0.0 on a board using the nRF52832.

In the file nrfx_wdt.c, the allocation index is declared/defined as:

static uint8_t m_alloc_index;

However, this variable is not initialized before being used e.g. tested for equality to 0 or as the terminating condition in a for loop.
In fact, I do not see any possible source code that could be assigning to this variable (this being a static variable, the assignment must be in this very file).
Is this a bug?

RMV

Parents
  • Hi RMV,

    Static or global variables are never uninitialized in C. Unless explicitly initialized to another value, they are implicitly initialized to zero. (Personally I prefer to explicitly set to zero to avoid confusion, but it is not required.) Local variables on the other hand are not implicitly initialized, so if this was a local variable, then it would have been a bug.

    Einar

Reply
  • Hi RMV,

    Static or global variables are never uninitialized in C. Unless explicitly initialized to another value, they are implicitly initialized to zero. (Personally I prefer to explicitly set to zero to avoid confusion, but it is not required.) Local variables on the other hand are not implicitly initialized, so if this was a local variable, then it would have been a bug.

    Einar

Children
Related