[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Linux Kernel Coding Style

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 23
Thread images: 3

File: linus-eff-you-640x363.png (213KB, 640x359px) Image search: [Google]
linus-eff-you-640x363.png
213KB, 640x359px
https://static.lwn.net/kerneldoc/process/coding-style.html

THIS MAN IS A GOD. EVERYONE SHOULD FOLLOW THIS.
>>
>>58634949
Everything except 8 width tabs is good.
>>
>>58635097
>Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you’re screwed anyway, and should fix your program.
>>
File: 1485165839404.jpg (45KB, 316x311px) Image search: [Google]
1485165839404.jpg
45KB, 316x311px
Na senpai
http://sdtimes.com/nasas-10-rules-developing-safety-critical-code/
>>
>>58635166
>tfw this is too true
Anxiety kicks in when I see my could going too far right. I know I am doing g something wrong but I convince myself I can make it work and then it doesn't.
>>
>>58635097
I agree with most of it, too, but this is one issue and the other is encouraging shortened variable names.

Sure, a good programmer can get away with "tmp", but I'd rather err on the side of caution and not give shitty programmers any leeway to use bad variable names.

>>58635196
This is pretty good, but talking about "assertion density" is useless management-speak. A better policy is also much simpler: use assertions to verify all of your inputs, even if they should be trusted. This also makes local formal verification much easier.
>>
>>58635166
I want multiple vertical splits worth of code at the same time, so I prefer even less than 80 characters per line.
>>
>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.
>>
>>58635320
Get a bigger screen
>>
>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.

Is this a not so subtle "fuck you" to Stallman?
>>
>>58634949
I knew there was nothing wrong with 8 character tabs but a few bullies here shat on me for having it
>>
>>58635320
Any 1920x<whatever> monitor should have no trouble with 2 side-by-side 80-character text files.
>>
>>58635332
Point is that 8 width tabs wastes a lot of vertical space.
2 is enough to see indentation levels clearly.
>>
>>58635097
If they're actually tabs, it really doesn't matter how thick they are since you can change that user side
>>
>>58635358
Everything Linus does is a fuck you to Stallman
>>
>>58634949
bikeshedding, the post
>>
>>58634949
> Shitting on good variable naming
Wew
>>
>>58635463
>width tabs
>vertical space

You're now officially retarded.
>>
>>58635515
This would be true if the Linux kernel didn't also use tabs for alignment all over the place. Also, if you do that you need to remember that each tab contributes 8 columns to the line width, even if you have it set to less.
>>
File: arm64_entry_s.png (54KB, 774x472px) Image search: [Google]
arm64_entry_s.png
54KB, 774x472px
>>58635613
For example, this is what the code can look like when you set tabs to 2 spaces
>>
>>58635611
Meant horizontal space obviously.
>>
>>58635611
shut up faggot.
>>
>>58634949
Thanks but no.
I'll continue to write my functions like so
int main() {
stuff;
}
Thread posts: 23
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.