Jump to content
  • Advertisement
Sign in to follow this  
F-Kop

flippy!!!!!!

This topic is 4400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Wouldn't it be nice to nice to have a framework that gives you a choice of naming conventions? I'm making one for my dev team, and I need some suggestions of formats to choose from, but none that nobody will ever use. And what would be a good short name for a namespace with stuff like types and common functions? Standard Types type_t type Type Local Variables varName VarName Global Variables g_varName gVarName Private Member Variables m_varName mVarName Static Member Variables s_varName sVarName Functions FunctionName functionName function_name Classes ClassName ClassName_t CClassName Interfaces InterfaceName InterfaceName_t IInterfaceName Structs StructName StructName_t SStructName Unions UnionName UnionName_t UUnionName Enumerators EnumName EnumName_t EEnumName Constants CONSTANT_NAME

Share this post


Link to post
Share on other sites
Advertisement
You might want to rethink your thread title.

Quote:
Original post by F-Kop
Wouldn't it be nice to nice to have a framework that gives you a choice of naming conventions?


Uh, you always have free choice what convention you use, and you always have the choice to name any given thing, as anything that is allowed by the language and doesn't conflict with something else. It just isn't necessarily a good *idea*.

So I really don't know what you mean by "framework" here. Are you trying to develop a coding standard for your project? If so, you don't really want to allow for much choice, because that rather defeats the purpose.

Share this post


Link to post
Share on other sites
I mean you use defines like NAMING_FUNCTION_CAPITAL to change the names of all the functions to the capital format etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by F-Kop
I mean you use defines like NAMING_FUNCTION_CAPITAL to change the names of all the functions to the capital format etc.
Leaving aside the question of why you'd want to do something like that, how would that work exactly? Can you give an example?

And:
Quote:
You might want to rethink your thread title.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Everywhere ive ever seen whatever_t has been a typedef.
E.g.
struct my_type_s{ int blah; };
typedef struct my_type_s my_type_t;

I use hungarian notation mostly (iMyInteger, flFraction, cCharacter).
And use g_, m_, and s_ on the front to show scope (global,member,static).

All of my core functionality is in a namespace named "core" ;)

Share this post


Link to post
Share on other sites

// someheader.h

#ifndef _FLIPPY_SOMEHEADER_H_
#define _FLIPPY_SOMEHEADER_H_

#ifdef NAMING_FUNCTION_CAPITAL
#define FUNCTION_OPEN_FILE OpenFile
#endif

#ifdef NAMING_FUNCTION_UNDERSCORE
#define FUNCTION_OPEN_FILE open_file
#endif

TYPE_HANDLE FUNCTION_OPEN_FILE( TYPE_STR fileName, TYPE_ENUM mode );

#endif



There's the general idea.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by F-Kop
I mean you use defines like NAMING_FUNCTION_CAPITAL to change the names of all the functions to the capital format etc.


This seems like a hell of a lot of work for not much benifit!

Eg every time you write a function
void
#ifdef CONVENTION_1
MyFunction
#else
#ifdef CONVENTION_2
myFunction
#else
#ifdef CONVENTION_3
my_function
#endif
#endif
#endif
( void );

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
Quote:
Original post by F-Kop
I mean you use defines like NAMING_FUNCTION_CAPITAL to change the names of all the functions to the capital format etc.
Leaving aside the question of why you'd want to do something like that ...
<snip>


Actually, I'm more interested in the 'why' part... [lol]

You mean programmers have to wrap all their code in macros, so that you can "convert" it to any given naming convention by changing a macro?

If so, isn't that just a very verbose, ugly, unreadable and messy naming convention your team is forced to follow?

Quote:

Wouldn't it be nice to nice to have a framework that gives you a choice of naming conventions?

Quite simply, no. The entire point in a naming convention is that you choose one and stick with it.

Edit, after seeing the OP's latest post above:
What a horrible horrible idea.

So, to define a function, I need to write 3x extra lines in an arbitrary header somewhere, where x is the number of "supported naming conventions"? If, god forbid, another naming convention is added, I have to go through *every* single function and variable, and add an extra macro for it?

When I want to *use* a function, I have to write something like

FUNCTION_OPEN_FILE(whatever)



Let's ignore for the moment that this name is 1) longer, 2) all caps, and 3) uses underscores, all of which makes it more difficult to type than a mere "open_file", "OpenFile" or "openFile". (Personally, I'd want to avoid at least some of those. Either use underscores, or use capitalized letters, but do I really need to use both?)

But more to the point, tell me again, how is that *not* a single naming convention you're enforcing? Where exactly is the freedom in choice of naming convention? I know that I *have* to use FUNCTION_OPEN_FILE and not openFile or open_file. That sounds like a naming convention to me.
A verbose, ugly and unsafe one, but still a naming convention of sorts.

Share this post


Link to post
Share on other sites
Lol, naming conventions are for the programmers, not for the preprocessor and the compiler[smile]. They don't care if you name your function OpenFile or oP_3NF1l_E. With your method, all the programmers going to see is FUNCTION_OPEN_FILE, so where's the difference?

Share this post


Link to post
Share on other sites
Not everything is going to use that format. Just the simple things that need to work on more than one platform, like a file class or a window class.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!