lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] [bug #35587] Uninitialized pointer


From: Mason
Subject: Re: [lwip-devel] [bug #35587] Uninitialized pointer
Date: Wed, 22 Feb 2012 11:32:29 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Firefox/10.0.2 SeaMonkey/2.7.2

Jiri Dobry wrote:

> Follow-up Comment #2, bug #35587 (project lwip):
> 
> Thanks for reaction, but I can't agree that it is invalid.
> 
> Why:
> - this stack is designed mainly for embedded systems and this world have some
> different rules. For example MISRA 2004 Rule Number 9.1: "All automatic
> variables shall have been assigned a value before being used.".

"Automatic" variable is short-hand for automatic storage duration.
These are so-called "local" variables.

next_timeout, on the other hand, has static storage duration.

cf. 3.1.2.4 Storage durations of objects

> 3.1.2.4 Storage durations of objects
> 
>    An object has a storage duration that determines its lifetime.
> There are two storage durations: static and automatic.
> 
>    An object declared with external or internal linkage, or with the
> storage-class specifier static has static storage duration.  For such
> an object, storage is reserved and its stored value is initialized
> only once, prior to program startup.  The object exists and retains
> its last-stored value throughout the execution of the entire
> program./12/
> 
>    An object declared with no linkage and without the storage-class
> specifier static has automatic storage duration. Storage is guaranteed
> to be reserved for a new instance of such an object on each normal
> entry into the block in which it is declared, or on a jump from
> outside the block to a label in the block or in an enclosed block.  If
> an initialization is specified for the value stored in the object, it
> is performed on each normal entry, but not if the block is entered by
> a jump to a label.  Storage for the object is no longer guaranteed to
> be reserved when execution of the block ends in any way.  (Entering an
> enclosed block suspends but does not end execution of the enclosing
> block.  Calling a function that returns suspends but does not end
> execution of the block containing the call.) The value of a pointer
> that referred to an object with automatic storage duration that is no
> longer guaranteed to be reserved is indeterminate.



reply via email to

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