Click here to Skip to main content
15,921,643 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to invoke a function at a regular interval? Pin
sashaf23-Sep-03 2:40
sashaf23-Sep-03 2:40 
GeneralRe: How to invoke a function at a regular interval? Pin
Mike Dimmick23-Sep-03 2:50
Mike Dimmick23-Sep-03 2:50 
GeneralRe: How to invoke a function at a regular interval? Pin
George223-Sep-03 16:44
George223-Sep-03 16:44 
GeneralRe: How to invoke a function at a regular interval? Pin
George223-Sep-03 16:45
George223-Sep-03 16:45 
GeneralQuestion about enum in C/C++ Pin
George223-Sep-03 1:48
George223-Sep-03 1:48 
GeneralRe: Question about enum in C/C++ Pin
567890123423-Sep-03 3:22
567890123423-Sep-03 3:22 
GeneralRe: Question about enum in C/C++ Pin
George223-Sep-03 16:51
George223-Sep-03 16:51 
GeneralRe: Question about enum in C/C++ Pin
Mike Dimmick23-Sep-03 4:03
Mike Dimmick23-Sep-03 4:03 
In C, enums, structs and unions have their own namespaces. To use them elsewhere, you must say (for example) enum goo_.

The use of typedef adds a new name to the global type namespace, where the name can be used without qualifiers. Therefore you can declare a variable of type enum foo_ just by using the type name foo.

C++ removes this distinction; while enums may still be referenced by prefixing enum, this is no longer required. This may break some C code if the C code uses the same name for both an enum and a typedef. Therefore all of foo, foo_ and goo_ can be referenced directly. You can still refer to foo_ and goo_ as enum foo_ and enum goo_ respectively.

Examples:
foo bar; <font color="green">/* OK */</font>
foo_ bar2; <font color="green">/* C++: OK, C: error */</font>
enum foo_ bar3; <font color="green">/* OK */</font>
goo_ bar4; <font color="green">/* C++: OK, C: error */</font>
enum goo_ bar5; <font color="green">/* OK */</font>
 
struct foo { int i; }; <font color="green">/* C: OK, C++: error */</font>
int foo_; <font color="green">/* C: OK, C++: error (IIRC) */</font>

GeneralRe: Question about enum in C/C++ Pin
George223-Sep-03 16:49
George223-Sep-03 16:49 
GeneralRe: Question about enum in C/C++ Pin
Mike Dimmick24-Sep-03 9:11
Mike Dimmick24-Sep-03 9:11 
GeneralRe: Question about enum in C/C++ Pin
George224-Sep-03 22:05
George224-Sep-03 22:05 
GeneralVectors Pin
bhangie23-Sep-03 0:56
bhangie23-Sep-03 0:56 
GeneralRe: Vectors Pin
YaronNir23-Sep-03 0:58
YaronNir23-Sep-03 0:58 
GeneralRe: Vectors Pin
jhwurmbach23-Sep-03 1:26
jhwurmbach23-Sep-03 1:26 
GeneralRe: Vectors Pin
bhangie23-Sep-03 1:31
bhangie23-Sep-03 1:31 
GeneralRe: Vectors Pin
bhangie23-Sep-03 1:36
bhangie23-Sep-03 1:36 
GeneralRe: Vectors Pin
jhwurmbach23-Sep-03 1:48
jhwurmbach23-Sep-03 1:48 
GeneralIcon sizing problem Pin
YaronNir23-Sep-03 0:56
YaronNir23-Sep-03 0:56 
GeneralRe: Icon sizing problem Pin
RobJones23-Sep-03 6:05
RobJones23-Sep-03 6:05 
GeneralRe: Icon sizing problem Pin
YaronNir23-Sep-03 6:11
YaronNir23-Sep-03 6:11 
GeneralRe: Icon sizing problem Pin
RobJones23-Sep-03 7:10
RobJones23-Sep-03 7:10 
GeneralChanging the DC's offset Pin
Zizilamoroso23-Sep-03 0:28
Zizilamoroso23-Sep-03 0:28 
GeneralRe: Changing the DC's offset Pin
vcplusplus23-Sep-03 3:14
vcplusplus23-Sep-03 3:14 
GeneralRe: Changing the DC's offset Pin
Zizilamoroso23-Sep-03 3:29
Zizilamoroso23-Sep-03 3:29 
GeneralRe: Changing the DC's offset Pin
vcplusplus23-Sep-03 7:21
vcplusplus23-Sep-03 7:21 

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.