![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Game engine designer
Join Date: May 2005
Location: Sweden
Posts: 312
Rep Power: 4
![]() |
namespace vs struct
Usually when I want global functions in my C++ applications I do like this:
namespace Tool
{
static inline int foo() {}
static inline int bar() {}
}
int main()
{
Tool::foo();
Tool::bar();
}Another more common way to achieve this result is by doing it this way: struct Tool
{
static inline int foo() {}
static inline int bar() {}
};
int main()
{
Tool::foo();
Tool::bar();
}So to my question: Is there a difference between them (have not checked the generated code yet)? Which one should I prefer and why? Thanks for your thoughts! /Klarre
__________________
http://www.klarre.se |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to create struct containing variable array struct | shoeyfighter | C | 14 | Nov 6th, 2006 4:26 AM |
| Casting a struct to s aimilar struct | shoeyfighter | C | 6 | Oct 27th, 2006 3:59 PM |
| Appreciate comments on some linked list code | Jessehk | C | 5 | Jul 20th, 2006 8:59 PM |
| struct program skipping inputs | codylee270 | C | 7 | Dec 5th, 2005 8:02 AM |
| c struct : problems whit structs containing each other | mevuorin | C | 10 | Jul 7th, 2005 2:05 PM |