On Tue, 2014-03-18, Javier Lopez wrote:
> This isn't a C-only question, but I like to name my functions or globals
> prepending the project name to avoid namespace pollution as in:
> void libunknown_dosomething(void);
If I'm not writing a reusable library (which I almost never do) I try
to avoid that[0]. Let the libraries you use do their prefixing thing,
and enjoy the luxury of giving your things simple names.
(They won't be that simple anyway, since you'll often end up with the
argument type as part of the name, e.g. list_is_empty() versus
house_is_empty().)
> In either case, I have an open question: how do you choose a project
> [code]name?
With difficulty.
/Jorgen
[0] In C++ I do it more often, but then I use namespaces, and they
lack many of the drawbacks of "manual" prefixing.
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
> This isn't a C-only question, but I like to name my functions or globals
> prepending the project name to avoid namespace pollution as in:
> void libunknown_dosomething(void);
If I'm not writing a reusable library (which I almost never do) I try
to avoid that[0]. Let the libraries you use do their prefixing thing,
and enjoy the luxury of giving your things simple names.
(They won't be that simple anyway, since you'll often end up with the
argument type as part of the name, e.g. list_is_empty() versus
house_is_empty().)
> In either case, I have an open question: how do you choose a project
> [code]name?
With difficulty.
/Jorgen
[0] In C++ I do it more often, but then I use namespaces, and they
lack many of the drawbacks of "manual" prefixing.
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Aucun commentaire:
Enregistrer un commentaire