EmbDev.net

Forum: ARM programming with GCC/GNU tools declairing volatile struct in include file


von Dustin S. (dbrazeau)


Rate this post
useful
not useful
Im trying to:

volatile struct  sDeviceReg
{
  .
  .
  .
};

and I'm getting the error:
error: qualifiers can only be specified for objects and functions

Am I doing this wrong??

Thanks

von Clifford S. (clifford)


Rate this post
useful
not useful
The error means just what it says, you cab have a volatile variable or
function but not a volatile data type.

struct  sDeviceReg
{
...
};

volatile struct sDeviceReg device_instance ;


or

volatile struct  sDeviceReg
{
...
} device_instance ;


Note that in both cases it is device_instance that is volatile not
sDeviceReg. If you create other instances of this structure, they will
only be volatile if you declare them so individually.

Clifford

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.