Click here to Skip to main content
15,914,220 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: compile error: storage size of 'var' isn't known Pin
David Crow28-Mar-07 5:59
David Crow28-Mar-07 5:59 
AnswerRe: compile error: storage size of 'var' isn't known Pin
Nemanja Trifunovic28-Mar-07 6:28
Nemanja Trifunovic28-Mar-07 6:28 
GeneralRe: compile error: storage size of 'var' isn't known Pin
George_George2-Apr-07 20:45
George_George2-Apr-07 20:45 
AnswerRe: compile error: storage size of 'var' isn't known Pin
prasad_som28-Mar-07 6:33
prasad_som28-Mar-07 6:33 
GeneralRe: compile error: storage size of 'var' isn't known Pin
Mark Salsbery28-Mar-07 7:15
Mark Salsbery28-Mar-07 7:15 
GeneralRe: compile error: storage size of 'var' isn't known Pin
David Crow28-Mar-07 7:47
David Crow28-Mar-07 7:47 
GeneralRe: compile error: storage size of 'var' isn't known Pin
Mark Salsbery28-Mar-07 8:05
Mark Salsbery28-Mar-07 8:05 
GeneralRe: compile error: storage size of 'var' isn't known [modified] Pin
toxcct28-Mar-07 8:20
toxcct28-Mar-07 8:20 
DavidCrow wrote:
I believe typedef is required in C, and is optional in C++


actually no. typedef is not required in C, but struct is.

that is, when you declare a structure and you want to declare a variable of that type, you must use the struct keyword :
<font color=blue>struct</font> TMyStruct {
    <font color=green>// Whatever...</font>
};
 
 
<font color=blue>struct</font> TMyStruct s1;    <font color=green>//OK in both C and C++</font>
TMyStruct        s2;    <font color=green>//OK in C++, but won't compile in C</font>

so, to get rid of that heavy notation, programmers used to typedef the structs/unions declarations :
<font color=blue>typedef struct</font> TMyStruct {
    <font color=green>// Whatever...</font>
} TMyStruct;
 
 
<font color=blue>struct</font> TMyStruct s1;    <font color=green>//still OK in both C and C++</font>
TMyStruct        s2;     <font color=green>//now OK in both C and C++</font>


[Edit (for Mark)]
Note that such an expression :
typedef struct Name {} name;
doesn't declare a variable of type name, but defines the synonym name for the type struct Name
to understand it, we can split it :
       type definition
               |
        /------------\
<code>typedef struct Name {} name;</code>
   \                    /
    \------------------/
             |
     typedef declaration

it's exactly like doing :
struct Name {};
typedef struct Name name;

Notice that a variable cannot be declared in a typedef instruction
[/edit]


GeneralRe: compile error: storage size of 'var' isn't known Pin
David Crow28-Mar-07 8:24
David Crow28-Mar-07 8:24 
GeneralRe: compile error: storage size of 'var' isn't known Pin
Eytukan29-Mar-07 1:41
Eytukan29-Mar-07 1:41 
GeneralRe: compile error: storage size of 'var' isn't known Pin
George_George2-Apr-07 21:38
George_George2-Apr-07 21:38 
GeneralRe: compile error: storage size of 'var' isn't known Pin
toxcct28-Mar-07 8:21
toxcct28-Mar-07 8:21 
GeneralRe: compile error: storage size of 'var' isn't known Pin
Mark Salsbery28-Mar-07 8:26
Mark Salsbery28-Mar-07 8:26 
GeneralRe: compile error: storage size of 'var' isn't known Pin
Stephen Hewitt28-Mar-07 13:44
Stephen Hewitt28-Mar-07 13:44 
GeneralRe: compile error: storage size of 'var' isn't known Pin
George_George2-Apr-07 20:56
George_George2-Apr-07 20:56 
GeneralRe: compile error: storage size of 'var' isn't known Pin
George_George2-Apr-07 21:20
George_George2-Apr-07 21:20 
Questionhow to send mouseclickmsg to window? Pin
Goggelmoggel28-Mar-07 5:17
Goggelmoggel28-Mar-07 5:17 
AnswerRe: how to send mouseclickmsg to window? Pin
David Crow28-Mar-07 5:54
David Crow28-Mar-07 5:54 
GeneralRe: how to send mouseclickmsg to window? Pin
Goggelmoggel28-Mar-07 6:05
Goggelmoggel28-Mar-07 6:05 
QuestionRe: how to send mouseclickmsg to window? Pin
David Crow28-Mar-07 6:30
David Crow28-Mar-07 6:30 
AnswerRe: how to send mouseclickmsg to window? Pin
prasad_som28-Mar-07 6:26
prasad_som28-Mar-07 6:26 
GeneralRe: how to send mouseclickmsg to window? Pin
Goggelmoggel28-Mar-07 6:32
Goggelmoggel28-Mar-07 6:32 
GeneralRe: how to send mouseclickmsg to window? Pin
James R. Twine28-Mar-07 6:36
James R. Twine28-Mar-07 6:36 
GeneralRe: how to send mouseclickmsg to window? Pin
Goggelmoggel28-Mar-07 6:41
Goggelmoggel28-Mar-07 6:41 
GeneralRe: how to send mouseclickmsg to window? Pin
James R. Twine28-Mar-07 6:47
James R. Twine28-Mar-07 6:47 

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.