Click here to Skip to main content
14,839,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: error C2143: syntax error Pin
_Flaviu9-Aug-19 0:20
Member_Flaviu9-Aug-19 0:20 
Questionzero-sized array in struct/union Pin
_Flaviu5-Aug-19 21:39
Member_Flaviu5-Aug-19 21:39 
AnswerRe: zero-sized array in struct/union Pin
Victor Nijegorodov5-Aug-19 22:13
MemberVictor Nijegorodov5-Aug-19 22:13 
GeneralRe: zero-sized array in struct/union Pin
_Flaviu5-Aug-19 22:24
Member_Flaviu5-Aug-19 22:24 
GeneralRe: zero-sized array in struct/union Pin
Victor Nijegorodov5-Aug-19 22:28
MemberVictor Nijegorodov5-Aug-19 22:28 
GeneralRe: zero-sized array in struct/union Pin
Randor 5-Aug-19 22:31
professional Randor 5-Aug-19 22:31 
GeneralRe: zero-sized array in struct/union Pin
CPallini5-Aug-19 22:36
mveCPallini5-Aug-19 22:36 
JokeRe: zero-sized array in struct/union Pin
Randor 5-Aug-19 22:43
professional Randor 5-Aug-19 22:43 
GeneralRe: zero-sized array in struct/union Pin
CPallini5-Aug-19 23:02
mveCPallini5-Aug-19 23:02 
GeneralRe: zero-sized array in struct/union Pin
Randor 5-Aug-19 23:34
professional Randor 5-Aug-19 23:34 
GeneralRe: zero-sized array in struct/union Pin
_Flaviu5-Aug-19 22:40
Member_Flaviu5-Aug-19 22:40 
QuestionRe: zero-sized array in struct/union Pin
CPallini5-Aug-19 23:29
mveCPallini5-Aug-19 23:29 
AnswerRe: zero-sized array in struct/union Pin
Randor 5-Aug-19 23:38
professional Randor 5-Aug-19 23:38 
AnswerRe: zero-sized array in struct/union Pin
leon de boer6-Aug-19 3:23
Memberleon de boer6-Aug-19 3:23 
PraiseRe: zero-sized array in struct/union Pin
CPallini6-Aug-19 10:15
mveCPallini6-Aug-19 10:15 
QuestionRe: zero-sized array in struct/union Pin
Richard MacCutchan5-Aug-19 22:14
mveRichard MacCutchan5-Aug-19 22:14 
AnswerRe: zero-sized array in struct/union Pin
_Flaviu5-Aug-19 22:27
Member_Flaviu5-Aug-19 22:27 
GeneralRe: zero-sized array in struct/union Pin
Richard MacCutchan5-Aug-19 22:43
mveRichard MacCutchan5-Aug-19 22:43 
You are using a typedef but have not given it the name that you wish to use. It should be something like:
typedef struct {
....
....
        char* file_name[0];         /* File name in Unicode. */
} myStruct;
// myStruct is now an alias for the above structure

Also the comment on the last line makes no sense; firstly it is declaring an aray of pointers rather than characters. And secondly, you should not store Unicode characters in a char type array. It will most likely cause problems at run time.

The zero length array is possibly valid, but it depends on how the code uses the struct. It can be used as a placeholder name for space that will be allocated for a dynamic structure at run time. Something like:
struct foo
{
    int i;
    char text[0];
};

// ... other code

struct foo* myFoo = (struct foo*)malloc(sizeof(struct foo) + 20); // additional 20 bytes for the char data.

GeneralRe: zero-sized array in struct/union Pin
Stefan_Lang6-Aug-19 21:53
mveStefan_Lang6-Aug-19 21:53 
GeneralRe: zero-sized array in struct/union Pin
Richard MacCutchan7-Aug-19 1:27
mveRichard MacCutchan7-Aug-19 1:27 
GeneralGet rid of the [] Pin
Davie212406-Aug-19 10:19
MemberDavie212406-Aug-19 10:19 
AnswerRe: zero-sized array in struct/union Pin
CPallini5-Aug-19 22:32
mveCPallini5-Aug-19 22:32 
GeneralRe: zero-sized array in struct/union Pin
_Flaviu5-Aug-19 22:41
Member_Flaviu5-Aug-19 22:41 
SuggestionRe: zero-sized array in struct/union Pin
Richard MacCutchan5-Aug-19 22:44
mveRichard MacCutchan5-Aug-19 22:44 
GeneralRe: zero-sized array in struct/union Pin
Stefan_Lang6-Aug-19 21:58
mveStefan_Lang6-Aug-19 21:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.