--- layout: fc_discuss_archives title: Message 39 from Frama-C-discuss on April 2011 ---
On 22 avr. 2011, at 18:51, "Wayne Pineault" <wpineault at dsci.com> wrote: > I am trying to access the const pointer attribute in > > int * const p; > > For global variables the attribute list for the TPtr typ contains the const but for variables in a function it does not. > > Why are local variables treated differently than global ones? > Speaking as a non-specialist, I would guess that the const is erased for local variables because of the way their initialization is transformed into an assignment. We could remove this transformation completely (it seems to cause more harm than good for static analysis) or add a dedicated attribute other than const so as not to confuse compilers which have to parse transformed C code. By the way, did you check whether there wasn't already such an attribute? It sounds like the kind of hack that might already exist(there is a similar one in place for arrays as function arguments). Pascal -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20110422/e50de07f/attachment.htm>