Click here to Skip to main content
15,927,213 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: About AfxMessageBox Pin
cp987628-Mar-07 18:10
cp987628-Mar-07 18:10 
GeneralRe: About AfxMessageBox Pin
bios808628-Mar-07 20:32
bios808628-Mar-07 20:32 
AnswerRe: About AfxMessageBox Pin
Paresh Chitte28-Mar-07 18:20
Paresh Chitte28-Mar-07 18:20 
AnswerRe: About AfxMessageBox [modified] Pin
zon_cpp28-Mar-07 19:27
zon_cpp28-Mar-07 19:27 
GeneralRe: About AfxMessageBox Pin
Parthi_Appu28-Mar-07 19:40
Parthi_Appu28-Mar-07 19:40 
GeneralRe: About AfxMessageBox Pin
zon_cpp28-Mar-07 19:53
zon_cpp28-Mar-07 19:53 
GeneralRe: About AfxMessageBox Pin
Parthi_Appu28-Mar-07 20:35
Parthi_Appu28-Mar-07 20:35 
Questionhelp! problem in gdi library? Pin
ghunzel0628-Mar-07 16:33
ghunzel0628-Mar-07 16:33 
Questionhow to download fonts to laser printer Pin
Stober28-Mar-07 11:40
Stober28-Mar-07 11:40 
AnswerRe: how to download fonts to laser printer Pin
Stober28-Mar-07 23:00
Stober28-Mar-07 23:00 
GeneralRe: how to download fonts to laser printer Pin
Mark Salsbery29-Mar-07 6:48
Mark Salsbery29-Mar-07 6:48 
QuestionHow to get the Error string of WSAGetLastError() Error code? Pin
TurboNext28-Mar-07 6:43
TurboNext28-Mar-07 6:43 
AnswerRe: How to get the Error string of WSAGetLastError() Error code? Pin
JudyL_MD28-Mar-07 6:45
JudyL_MD28-Mar-07 6:45 
GeneralRe: How to get the Error string of WSAGetLastError() Error code? Pin
James R. Twine28-Mar-07 6:49
James R. Twine28-Mar-07 6:49 
AnswerRe: How to get the Error string of WSAGetLastError() Error code? Pin
David Crow28-Mar-07 6:59
David Crow28-Mar-07 6:59 
AnswerRe: How to get the Error string of WSAGetLastError() Error code? Pin
TurboNext28-Mar-07 7:04
TurboNext28-Mar-07 7:04 
Questioncompile error: storage size of 'var' isn't known Pin
George_George28-Mar-07 5:46
George_George28-Mar-07 5:46 
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]


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.