Go Down

Topic: What is the 'config_t'? (Read 3080 times) previous topic - next topic

SouthernAtHeart

The code I'm working with:
http://www.arduino.cc/playground/Code/EEPROMWriteAnything

I know it works, but if I can understand HOW, it'll be way better. So...
There's no mention of 'struct' in the reference pages, but I understand that it makes something like a group variable.  What is the 'config_t'?  I couldn't find much googling it.
struct config_t
{
    long alarm;
    int mode;
} configuration;


Coding Badly

It's called a "tag".  It's somewhat like a typedef.  It allows you to create multiple instances of the structure...

struct config_t ConfigLoadedFromStorage;

struct config_t UserModifiableConfig;

SouthernAtHeart


SouthernAtHeart

...no, it doesn't seem to be optional like that webpage says, at least it doesn't compile without it.

Coding Badly

It is optional.  This compiles without error...

Code: [Select]
struct
{
    long alarm;
    int mode;
} configuration;

void setup( void )
{
}

void loop( void )
{
}

Go Up