Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-03 by Robert Adsett

At 01:21 AM 11/3/2007 -0600, Cat wrote:
>Hi Robert,
>I didn't say there's any pointer.

You did actually "I'm thinking that maybe in the second case somehow only 
the pointer becomes
volatile"

>Except maybe that the name of an array is a pointer.

No it isn't.  That was my point.  The name of an array is not a pointer it 
is an array.  the types are different.  In some circumstances it gets 
converted to a pointer but it is not a pointer.  Just like a char is not a 
long even though in some circumstances it gets converted to a long.

That's also why I quoted the cdecl output, it shows the underlying type 
quite clearly.

>I only use "volatile" to make a variable modifiable from an ISR.
>And it works, except for arrays.

Either there is a compiler bug, or more likely you are expecting a 
behaviour volatile just doesn't guarantee.

Can you narrow it down a bit and show us a extract of code that exhibits 
the problem?  Maybe we can help a little better with additional information.


Robert

"C is known as a language that gives you enough rope to shoot yourself in
the foot."  -- David Brown in comp.arch.embedded
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.