TYPEDEF Style 
Author Message
 TYPEDEF Style

Dear People of the World,

typedef struct tagsize {
    int cx;
    int cy;

Quote:
} SIZE;

Forgive me, but why bother with this typdef? Why not just create a struct
named SIZE?

Regards

Sher



Sun, 01 Apr 2001 03:00:00 GMT  
 TYPEDEF Style
It's for backward compatibility with C. If you just declare the struct,
the this:

SIZE s;

is valid in C++ but generates an error in C. Without the typedef,
C would require:

struct SIZE s;

this allows Microsoft to minimize conditional compilation in the
header files.

--
Ron Ruble
Raffles Software Development, Inc.

Patient - Doctor, it hurts when I do this!
Doctor - Then don't do that.

Quote:

>Dear People of the World,

>typedef struct tagsize {
>    int cx;
>    int cy;
>} SIZE;

>Forgive me, but why bother with this typdef? Why not just create a struct
>named SIZE?

>Regards

>Sher



Sun, 01 Apr 2001 03:00:00 GMT  
 TYPEDEF Style

Quote:

>Dear People of the World,

>typedef struct tagsize {
>    int cx;
>    int cy;
>} SIZE;

>Forgive me, but why bother with this typdef? Why not just create a struct
>named SIZE?

Because the above was written for C. The logical next question is, "Why
'tagsize' instead of 'SIZE'?" That I don't know.

--
Doug Harrison



Sun, 01 Apr 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Typedef structs within typedef structs...

2. Typedef structs within typedef structs...

3. To typedef or not to typedef, that is the question

4. old style casts vs new style casts

5. K&R C style to ANSI C Style

6. new style declarations OK for old style definitions?

7. Need help with reinterpret_cast, a C-style cast or function-style cast

8. Convert old-style func decl to ANSI-style?

9. old style casts vs new style casts

10. Need help with reinterpret_cast, a C-style cast or function-style cast

11. Need help with reinterpret_cast, a C-style cast or function-style cast

12. old C style to new C style conversion

 

 
Powered by phpBB® Forum Software