C style
1
Name:
Anonymous
2011-05-31 17:44
Hey /prog/,
I know basic C and don't want a tutorial on pointers and that. I'm looking for a tutorial on style (e.g. it would be a nice idea to provide a <structure>_free function for any struct <structure>_t that I create, etc.) -- where can I find this? The GNU guideline doesn't discuss this.
Reading code might be an idea but I really wouldn't know where to start, and I could end up picking up bad style. So some kind of guide that you think is good would be nice.
2
Name:
Anonymous
2011-05-31 17:46
3
Name:
Anonymous
2011-05-31 17:51
>>1 check out the git source
4
Name:
Anonymous
2011-05-31 18:10
>>1
C has no correct style, do what you want.
5
Name:
Anonymous
2011-05-31 18:17
>>4
>implying any language has style
6
Name:
Anonymous
2011-05-31 18:18
>>5
Lisp has a pretty natural style, Python forces his whitespaces down your throat until you choke on them and then rapes your dead body, Pascal, Java, C#, and other languages have a pretty ``standardized'' style (because their standard libraries don't suck as much as C's).
Also, go back to the imageboards.
7
Name:
Fuck you,
!Ep8pui8Vw2
2011-05-31 18:23
>>6
Lisp has a pretty natural style
AHAHAHAHAHA
back to the imageboards
Fuck off,
``faggot'' .
8
Name:
Go back to /b/,
!uaVa00FkCs
2011-05-31 18:25
>>7
Go back to /b/,
``please'' .
9
Name:
Anonymous
2011-05-31 18:29
So, uh, say I still want to use C, what do I do?
Sure can't be the standard libraries' fault. Aren't there for instance "common idioms" on caller vs. callee doing memory deallocation?
10
Name:
Anonymous
2011-05-31 18:30
>>8
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ___ █
█ // 7 █
█ (_,_/\ WORSHIP THIS █
█ \ \ YOUR THROBBING GOD █
█ \ \ █
█ _\ \__ █
█ ( \ ) █
█ \___\___/ █
█ █
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
11
Name:
Anonymous
2011-05-31 18:38
Use whatever style that the projects you work on use. If you are interested in GNU style, perhaps you can look at the source code for the GNU coreutils.
12
Name:
Anonymous
2011-05-31 18:49
GNU coreutils
Worst C coding style ever.
13
Name:
Anonymous
2011-05-31 19:06
>>12
While I agree, the OP mentioned the GNU Guidelines, so I decided to be productive rather than insult his tastes.
14
Name:
Anonymous
2011-05-31 19:19
Uh yeah I just didn't know where to look. If there's other guidelines feel free to point them out.
15
Name:
Anonymous
2011-05-31 20:37
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ___ █
█ // 7 █
█ (_,_/\ WORSHIP THIS █
█ \ \ YOUR THROBBING GOD █
█ \ \ █
█ _\ \__ █
█ ( \ ) █
█ \___\___/ █
█ █
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
16
Name:
Anonymous
2011-05-31 20:42
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ___ █
█ // 7 █
█ (_,_/\ WORSHIP THIS █
█ \ \ YOUR THROBBING GOD █
█ \ \ █
█ _\ \__ █
█ ( \ ) █
█ \___\___/ █
█ █
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
17
Name:
Anonymous
2011-05-31 20:44
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ___ █
█ // 7 █
█ (_,_/\ WORSHIP THIS █
█ \ \ YOUR THROBBING GOD █
█ \ \ █
█ _\ \__ █
█ ( \ ) █
█ \___\___/ █
█ █
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
18
Name:
Anonymous
2011-05-31 20:44
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ___ █
█ // 7 █
█ (_,_/\ WORSHIP THIS █
█ \ \ YOUR THROBBING GOD █
█ \ \ █
█ _\ \__ █
█ ( \ ) █
█ \___\___/ █
█ █
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
19
Name:
Anonymous
2011-05-31 21:26
20
Name:
Anonymous
2011-05-31 22:51
it would be a nice idea to provide a <structure>_free function for any struct <structure>_t that I create
Why?
21
Name:
VIPPER
2011-06-01 3:50
You know its summer when /prog/ is shit.
>>17-18
UM KWAT MUMFALA
UM KWAT MUMFALA
23
Name:
Anonymous
2011-06-01 7:20
>>21
Oh fuck, it's summer~
24
Name:
Anonymous
2011-06-01 8:02
>>23
lets go 2 teh bitch (taht means ur mom lol)
25
Name:
Anonymous
2011-06-01 9:42
>>21
Would that mean it's always summer in /prog/?
26
Name:
Anonymous
2011-06-01 10:18
>>25
Only when /g/, /lounge/, /b/, spammers and domyhoemworkzplzs take over
/prog/ .
27
Name:
Anonymous
2011-06-01 12:06
>>21
SUMMER ALL YEAR ROUND
28
Name:
Anonymous
2011-06-01 12:08
>>27
Good. Now you have the perfect excuse to wear your sisters black leggings out in public. Because it's too warm to be wearing jeans.
29
Name:
Anonymous
2011-06-01 13:00
It's ``bad style'' to name your structs <struct>_t, since POSIX reserves the use of *_t names.
30
Name:
Autistic Duck
2011-06-01 13:20
>>27
ETERNAL SUMMER OF THE SPOTLESS PROG
31
Name:
Anonymous
2012-07-13 1:16
>>23
lol u tk him 2da bar|?
32
Name:
Anonymous
2012-07-13 2:01
>>12
GNU coreutils
Worst C coding ever.
Fixed
33
Name:
Anonymous
2012-07-13 2:53
Good C style for a large project: Windows 2000
http://www.mediafire.com/?dkkqh480ervgewa
34
Name:
Anonymous
2012-07-13 6:22