#Searching the C Code Convention

55 messages · Page 1 of 1 (latest)

opal void
#

Searching the C Code Convention

tight novaBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

pure ore
#

There is no the C code convention.

gilded rivet
#

You mean best coding practices?

#

I'm not aware of any resources for that either; it tends to be quite subjective and up to the programmers

charred forum
pure ore
#

?

gilded rivet
#

Probably not what OP was asking for

opal void
gilded rivet
#

That C reference manual is literally just a syntax sheet, not a style guide

opal void
#

hmm mostly ye

#

what is the difference between syntax and style ?

pure ore
#

Syntax is the rules, styles are possible variations within those rules.

opal void
#

yes and in the code conventions it shows some styles and prohibits anything else

#

i can write
int x = 8,
b =9;

Or

Int x =5;
int b =6;

and it doesnt encourage

int x=4, b=6;

#

a while statement has only one style.
what else can there be ?

#

if it shows only one, it excludes anything else

#

because otherwhise it would mean we would have 1000 styles and everyone can be in a situation to need to learn another style just to understand the code

wheat magnet
opal void
#

i think i take that

#

4times the amount of pages as the java convention 😂

wheat magnet
#

yes but they explain their choices using "rationals"

deft summit
#

and I mean many competing ones

#

and to quote very beginning of that document, because someone sent some GNU link (although not for coding convention):

First off, I’d suggest printing out a copy of the GNU coding standards, and NOT read it. Burn them, it’s a great symbolic gesture.

deft summit
opal void
#

it looks diffferent

deft summit
#

they've sent C compiler manual, but it also containts examples in the shitty convention iirc

#

but there exists GNU coding convention document as well

#

ignore it :P

opal void
#

the gnu c-manual explains integere very detailed

gilded rivet
#

Yes, because it's a syntax manual and not a style guide

opal void
#

ok then im looking for a syntax sheet

#

which one you cann suggest @gilded rivet

deft summit
#

then it sounds you are looking for C book

#

lol

deft summit
#

but earlier you explicitly showed examples on coding style matters

#

just two completely different things, learning about C and its data types

#

and learning how to format your code for readability

opal void
#

isnt that included in the code convention ?

#

the gnu c manual looks more detailed

#

but its even better that way

#

understanding the tools, Syntax and types

deft summit
#

there's no requirement, no official standard, no single style of writing C code

#

different projects, different styles

#

there's a core type system in C and that's a part of the standard

#

unrelated to code formatting

#

the formatting is a matter of preferences, taste, agreement in project/team

#

for learning what data types you have you learn C, the C programming language, it is separate from choosing a formatting style

#

note there are publicly available final drafts of the C standard document (the official final document is paid), but not the best learning material at the beginning