[Fresco-devel] Suggested addition to Coding Style-guide
Neil Pilgrim <[email protected]> Sat, 12 Apr 2003 18:59:57 +0100
| Newsgroups | gmane.comp.video.fresco.devel |
|---|---|
| Message-ID | <[email protected]> |
----
When using a class name in a function declaration such as:
void do_foo(some_type &x);
int do_bar(type_space::nested_type *y);
it is often not necessary to include the entire header file in which the
types are declared. Instead it is preferable, to reduce build-time
dependencies, to use:
void do_foo(class some_type &x);
or if some_type is used multiple times within the same file (or the
class is within a namespace), to predeclare:
class some_type;
namespace type_space
{
class some_type;
};
/* ... */
void do_foo(some_type &x);
void do_bar(type_space::nested_type *y)
----
In quite a few instances (if not a *lot*!) we don't currently do this;
it seems like a good common idea, so assuming no discussion to the
contrary it'd be good to add it to the coding guide. Oh, and implement
it ;)
Comments?
--
Neil