C Etiquette Question
Hey guys its been a while since I've programmed in C (just returned from Java and C#) So I forgot the etiquette for three things:
1. Is it alright if my functions that return something start with ret? (e.g. retNumOfBytes, retReads etc.)
2. In C, do functions typically start lower case and then other word upper case (e.g myFunction, funcTwo)
3. Is it ok, if my typedefs are all uppercase?
I'm writing open source code, so I don't want to upset any programmers.
2. Maybe, just be consistent (but I wouldn't)
3. Maybe, just be consistent (but I wouldn't)
#2 is called "camel case"
I would think it's rare for typedefs to be uppercase -- uppercase is generally only for #defines.
2) C typically has underscore seperated functions: my_function()
3) No, typedefs should be lowercase. All uppercase is usually for macros (#define)
> I'm writing open source code, so I don't want to upset any programmers.
You'll always upset some programmers :)
In general, only #defines are all uppercase.
Pretty much everything else is up to you. Most people don't mind so long as you apply your rules consistently.
Adopt a style you like from other source code perhaps.
To me it looks cleaner to see the windows style functions of Capitals for every first word.
If you are writing code for an established project then you'll want to take a look at their current style and use that. If you are starting your own then just do what feels right.
I seem to remember years ago using the convention of all caps for class names. It seems to have fallen out of favor though.
Is it? Now I know why one of my coworkers started blushing when I refered to her camel toe style. Thanks for clearing that one up, Todd.
Originally Posted by Dino
Blushing? Not throwing things? Or yelling?
Originally Posted by master5001
What can I say, I have a way with words. The sensitivity training seminar tickets I won because of a random drawing were pretty awesome though.... hey wait a minute!!
I know how that goes. A couple months ago, I was talking with a female coworker, and we were talking about the new female manager. My female coworker mentioned that the new manager was wearing tight white pants on her first day in a mostly-male office.
I told her, in these exact words, "Tight white pants are hard to pull off". But what I actually meant was from a fashion standpoint, not a "getting her undressed" standpoint. It was quite funny.
Hahaha! I have never actually had to go to a sensitivity seminar. I think as long as you are not a creepy scoundrel you can jest even about things that are semi-sexual (or even quite sexual) without getting sued by your coworkers.
On a side-note, is it not a tad uncouth to be patting your own quotes on the back? Though that one is actually quite amusing. So I will give it to you.