Hi guys...
I am using this compiler with something like this :
/* PROTOCOL HEADER */
typedef struct AEP_Header{
long ID; // The device ID
char DataSize; // The Data Size of the whole data going to follow
};
/* VARIOUS ITEMS */
// Standard Reply
typedef struct AEP_Reply{
struct AEP_Header; <<-- 'Invalid declaration syntax' ON THIS LINE
char Reply;
char CheckSum;
};
So, it's a standard template used for an unnamed variable
Now, the compuler gives me error on the marked line, 'Invalid declaration syntax '...
I can suppose I need to declare the SUEOPT option for the compiler to use an unnamed structure, but found no place where to put such an option, even reading the manuals...
1st - In manual it's reported as 'SUEOPT(struct_opt)', what does this means, it's not clear what 'struct_opt' is for...
2nd - Where to place this options, tried with #pragma and got an unknown pragma error, and found no 'RCSTM8 general options' box anywhere in the IDE as told by the manuals...
3rd - Placed in IDE defines too, but always got that such a SUEOPT is unknown...
4th - would this 'unnamed' declaration be accepted by this compiler...?
Tnx
Best regards...
Alex Vallone
Official STM Consultant
|
Hi Alex,
This is a documentation bug: The shortcut is SUE_OPT, not SUEOPT! We will correct the documentation appropriately.
The full pragma name is "struct_opt" and is correctly documented. You can invoke it through the following first line in your code:
#pragma SUE_OPT
However, it does NOT do what you want: What it does is that it enables you to remove the "struct" keyword, but not to remove the field name (no unnamed fields possible).
So you can write:
I hope this helps,
Bruno