Frama-C-discuss mailing list archives
This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Frama-c-discuss] Jessie - static variable
- Subject: [Frama-c-discuss] Jessie - static variable
- From: loganjerry at gmail.com (Jerry James)
- Date: Tue, 19 Feb 2013 09:27:31 -0700
- In-reply-to: <5123A3CC.3000501@inria.fr>
- References: <CAEtoXR1pJfHHoWB-0DDMqyO2U-qW3FfuftjxPbeguVeTStUBtQ@mail.gmail.com> <512141F6.2040003@inria.fr> <CAEtoXR1rGXFyAyYNfOq9d3wvay8=pgFL35-9d5JDh9Y60_V6qQ@mail.gmail.com> <5123A3CC.3000501@inria.fr>
On Tue, Feb 19, 2013 at 9:09 AM, Claude Marche <Claude.Marche at inria.fr> wrote: > Notice that it seems that your code relies on the fact that static variables > are initialised to 0. I'm not sure it is guaranteed by the C standard. >From the C11 draft standard of 12 April 2011, Section 6.7.9 (Initialization), paragraph 10: If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate. If an object that has static or thread storage duration is not initialized explicitly, then: ? if it has pointer type, it is initialized to a null pointer; ? if it has arithmetic type, it is initialized to (positive or unsigned) zero; ? if it is an aggregate, every member is initialized (recursively) according to these rules, and any padding is initialized to zero bits; ? if it is a union, the first named member is initialized (recursively) according to these rules, and any padding is initialized to zero bits; >From the draft C89 standard (see http://flash-gordon.me.uk/ansi.c.txt), Section 3.5.7 (Initialization), subsection "Semantics": If an object that has static storage duration is not initialized explicitly, it is initialized implicitly as if every member that has arithmetic type were assigned 0 and every member that has pointer type were assigned a null pointer constant. If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate. Regards, -- Jerry James http://www.jamezone.org/
- References:
- [Frama-c-discuss] Jessie - static variable
- From: rovedy at ig.com.br (Rovedy Aparecida Busquim e Silva)
- [Frama-c-discuss] Jessie - static variable
- From: Claude.Marche at inria.fr (Claude Marche)
- [Frama-c-discuss] Jessie - static variable
- From: rovedy at ig.com.br (Rovedy Aparecida Busquim e Silva)
- [Frama-c-discuss] Jessie - static variable
- From: Claude.Marche at inria.fr (Claude Marche)
- [Frama-c-discuss] Jessie - static variable
- Prev by Date: [Frama-c-discuss] Jessie - static variable
- Next by Date: [Frama-c-discuss] Jessie - static variable
- Previous by thread: [Frama-c-discuss] Jessie - static variable
- Next by thread: [Frama-c-discuss] Jessie - static variable
- Index(es):