On Suday the 11th of February, 2007 -after 3 and a half years on InvisionFree, we have moved! This old board remains as a read only archive of years past, and registration has been disabled here. All new and current members should register at http://www.cpplc.net/forum .


Create your own social network with a free forum.
zIFBoards - Free Forum Hosting
Welcome to C++ Learning Community. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Name:   Password:

Please help out
Google

Pages: (2) [1] 2  ( Go to first unread post ) Reply to this topicStart new topicStart Poll

> Naming convention, witch do you prefer ?
 
witch naming convention you like/use most of all
foo_bar [ 10 ]  [13.51%]
foobar [ 10 ]  [13.51%]
Foo_Bar [ 5 ]  [6.76%]
FooBar [ 24 ]  [32.43%]
FOOBAR [ 5 ]  [6.76%]
FOO_BAR [ 1 ]  [1.35%]
CFooBar [ 6 ]  [8.11%]
CFoo_Bar [ 2 ]  [2.70%]
cfoobar [ 1 ]  [1.35%]
cfoo_bar [ 1 ]  [1.35%]
cFooBar [ 6 ]  [8.11%]
cFoo_Bar [ 3 ]  [4.05%]
Total Votes: 74
Guests cannot vote 
C-Man
Posted on Jan 6 2005, 09:36 PM
Quote Post


Lazy bum


Group: Super Moderator
Posts: 4,563
Member No.: 609
Joined: 29-February 04



lets say foobar is a class


--------------------
user posted image
PMEmail PosterUsers Website MSN
Top
Loki_Laughs
Posted on Jan 6 2005, 09:44 PM
Quote Post


nerd


Group: Members
Posts: 81
Member No.: 1,050
Joined: 22-October 04





That depends on what the identifier is for.


Different conventions for:

MACROS

variables
member variables
static member variables
global variables
local variables

functions
global functions
static functions
methods
static methods

Types
Class
you get the idea.

Some of these overlap for me.



--------------------
If you dont know where you are going, you can't be lost.
PMEmail Poster
Top
KTC
Posted on Jan 6 2005, 10:53 PM
Quote Post


std::freak


Group: Members
Posts: 1,465
Member No.: 420
Joined: 30-December 03



He said foobar was a class name tongue.gif (Yes, it varies for me as well)


--------------------
PMUsers Website
Top
TheHawgMaster
Posted on Jan 7 2005, 01:51 AM
Quote Post


Offtopic Bum


Group: Members
Posts: 1,783
Member No.: 23
Joined: 7-July 03



FooBar for classes... Camel notation for most else smile.gif


--------------------
Short ones, tall ones, skinny ones, bigger
Love is the gun and we pullin' that trigger
- Toby Mac
PMEmail PosterUsers Website MSN
Top
Nintendofreak88
Posted on Jan 7 2005, 02:11 AM
Quote Post


Programming Addict


Group: Super Moderator
Posts: 757
Member No.: 374
Joined: 13-December 03



I use FooBar for classes, class methods, and functions. Camel for everything else, like THM. biggrin.gif


--------------------
Formerly known as Nintendofreak88. My Web Site

user posted image
user posted image
user posted image
PMEmail PosterUsers Website
Top
ih8censorship
Posted on Jan 7 2005, 04:22 AM
Quote Post


Megalomaniac


Group: Admin
Posts: 2,469
Member No.: 1
Joined: 20-June 03



moved to the general c++ forum since its not really a help topic. anyway for a class id use FOOBAR. im finding that i like types to be capitalized and then the object lowercase. i do all sorts of things with functionnames though rolleyes.gif


--------------------
user posted image

The Windows Operating system is so buggy. most of my c++ programs wont run on it. i do not write programs with bugs. my programs just do random things.

Join Marapets
PMEmail PosterUsers Website AOLMSN
Top
Gmakermaniac!!!
Posted on Jan 8 2005, 03:20 AM
Quote Post


Zorro would kill Chuck Norris


Group: Members
Posts: 690
Member No.: 844
Joined: 21-June 04



FOOBAR for macros, FoObAr (or, like a sane person FooBar) for classes, functions, variables and members.


--------------------
the fail is strong with this one
"never leave the room when your code is running"

http://zorro.nukelol.com (my website [unfinished])
PMEmail PosterUsers Website ICQAOLYahooMSN
Top
dorto
Posted on Jan 8 2005, 06:51 AM
Quote Post


geek


Group: Members
Posts: 268
Member No.: 1,143
Joined: 20-December 04



QUOTE (ih8censorship @ Jan 7 2005, 04:22 AM)
anyway for a class id use FOOBAR.

class id? you mean class name? though one can use any naming convention for naming classes, functions etc but using upper case for macros and constants is followed almost universally in c++ fraternity. so anything *other than* all-upper-case could be used for the class names etc. ofcourse, "underhanded names"(ones that begin with an underscore or that contain a double underscore) should NEVER be used.


--------------------
dorto

Absolute Beginner(programming): 'You Can Do It' by Francis Glassborow
Absolute Beginner(c++): 'Accelerated C++' by Andrew Koenig and Barbara Moo
Free Online Book: http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
C++ Bible: 'The C++ Programming Language' by Bjarne Stroustrup
PMEmail Poster
Top
vbgamer45
Posted on Jan 8 2005, 07:40 PM
Quote Post


N00b!!!


Group: Members
Posts: 13
Member No.: 1,163
Joined: 3-January 05



I like CFooBar
Normally I like to have the first letter of the type lower case but in this case its better to keep the C upper case since thats what a lot of the classes use.
And then I like to captialize each word.


--------------------
SMF For Free - Free Simple Machines Forum Hosting.
PMEmail Poster
Top
Gmakermaniac!!!
Posted on Jan 9 2005, 12:43 AM
Quote Post


Zorro would kill Chuck Norris


Group: Members
Posts: 690
Member No.: 844
Joined: 21-June 04



I dislike hungarian notation fore some reason. It kakes the names of everything more confusing when I can just place my mouse over the variable name to figure out it's type. It I were using notepad, I would consider using hungarian notation.


--------------------
the fail is strong with this one
"never leave the room when your code is running"

http://zorro.nukelol.com (my website [unfinished])
PMEmail PosterUsers Website ICQAOLYahooMSN
Top
vbgamer45
Posted on Jan 9 2005, 01:51 AM
Quote Post


N00b!!!


Group: Members
Posts: 13
Member No.: 1,163
Joined: 3-January 05



Makes things more confusing? How so? I find it better as soon as you look at a variable you instantly know the type and general function of it and don't have to go around finding what type it is.


--------------------
SMF For Free - Free Simple Machines Forum Hosting.
PMEmail Poster
Top
dorto
Posted on Jan 9 2005, 04:02 AM
Quote Post


geek


Group: Members
Posts: 268
Member No.: 1,143
Joined: 20-December 04



Hungarian Notation is dead - even in microsoft circles.

Herb Sutter says: "it has mixed utility in type-unsafe languages(like C), it is possible but has no benifits (only drawbacks) in object-oriented languages(like smalltalk), and it is impossible in generic programming. Therefore, no C++ programmer should use Hungarian notation."

it has mixed utility in C like languages because: 1.(adv)it helps in identifying the type immediately by looking at the variable 2.(disadv)but when the type of a variable changes, it is not likely that you are going to hunt through all the code and change all occurrences of its name. For an example of this, look at the documentation for wParam in Microsoft Windows 32-bit: It changed from a 16-bit value (w stands for word) to a 32-bit value (which should have been dwParam)

in OO languages, variables are typeless - they contain an object, the type of which depends on the object itself, not the variable.

in generic code, ofcourse, hungarian notation is just impossible.


--------------------
dorto

Absolute Beginner(programming): 'You Can Do It' by Francis Glassborow
Absolute Beginner(c++): 'Accelerated C++' by Andrew Koenig and Barbara Moo
Free Online Book: http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
C++ Bible: 'The C++ Programming Language' by Bjarne Stroustrup
PMEmail Poster
Top
ih8censorship
Posted on Jan 9 2005, 05:00 AM
Quote Post


Megalomaniac


Group: Admin
Posts: 2,469
Member No.: 1
Joined: 20-June 03



QUOTE
anyway for a class id use FOOBAR.

class id? you mean class name? though one can use any naming convention for naming classes, functions etc but using upper case for macros and constants is followed almost universally in c++ fraternity.
actually it was class i would- contraction and forgot the ' so it would have been i'd laugh.gif but ya for the class name, and struct names i like to have uppercase, the reason is i like to retain in my short term memory what is an object, what is a class, what is a variable, what is a function. im finding i like to take advantage of c++'s case sensitive nature, so at a glance i can tell whats what (the case sensitive id's are very good for parameters of a function)


--------------------
user posted image

The Windows Operating system is so buggy. most of my c++ programs wont run on it. i do not write programs with bugs. my programs just do random things.

Join Marapets
PMEmail PosterUsers Website AOLMSN
Top
dr voodoo
Posted on Jan 9 2005, 09:26 AM
Quote Post


c++ programmer


Group: Super Moderator
Posts: 1,986
Member No.: 11
Joined: 23-June 03



QUOTE (ih8censorship @ Jan 9 2005, 05:00 AM)
QUOTE
anyway for a class id use FOOBAR.

class id? you mean class name? though one can use any naming convention for naming classes, functions etc but using upper case for macros and constants is followed almost universally in c++ fraternity.
actually it was class i would- contraction and forgot the ' so it would have been i'd laugh.gif but ya for the class name, and struct names i like to have uppercase, the reason is i like to retain in my short term memory what is an object, what is a class, what is a variable, what is a function. im finding i like to take advantage of c++'s case sensitive nature, so at a glance i can tell whats what (the case sensitive id's are very good for parameters of a function)

And I want to remeber what is a macro, what a class and what a variable:

MACROFOO
ClassFoo
var_foo
func_foo() or FuncFoo() or funcFoo()

It's no problem to seperate all 4 things using there names. A special convention for functions is useless because they are the only which are followed by a (.


--------------------
Conscience doesn't really keep you from doing anything wrong -- it merely keeps you from enjoying it.

My Site
My Tutorial
PMEmail PosterUsers Website
Top
C-Man
Posted on Jan 9 2005, 11:46 AM
Quote Post


Lazy bum


Group: Super Moderator
Posts: 4,563
Member No.: 609
Joined: 29-February 04



i dislike the hungarian notation cause it just looks plain ugly too me wacko.gif
and i can't decide witch looks better to me
class_foo::funct_foo
or
ClassFoo::FunctFoo


--------------------
user posted image
PMEmail PosterUsers Website MSN
Top
« Next Oldest | C++ in General | Next Newest »
DealsFor.me - The best sales, coupons, and discounts for you

Topic OptionsPages: (2) [1] 2  Reply to this topicStart new topicStart Poll


Skin selector developed by XJONX. Skins created by various members of the IF Skin Zone and InvisionFree Skinning

Please help out
Hosted for free by zIFBoards* (Terms of Use: Updated 2/10/2010) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Page creation time: 0.1732 seconds | Archive