Saturday, 18 January 2020

[linux] codingstyles

Resources

https://www.youtube.com/watch?v=LLBrBBImJt4
https://gist.github.com/17twenty/8154928

codingstyles

  • Use tabs (8 characters)
  • 80 character line limit
  • if-statement
if (error != -ENODEV) {
        foo();
        bar();} 
else {        report_error();        goto exit;}
if (error != -ENODEV)        foo();else        goto exit;
  • functions
int function(int *baz){        do_something(baz);        return 0;}

vim

  • modify default
vim ~/.vimrc
filetype plugin indent onsyntax on
set number
set title
set tabstop=8set softtabstop=8set shiftwidth=8set noexpandtab
  • or via commands
:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab
  • set /usr/bin/vim/basic as default editor 
sudo update-alternatives --config editor

scripts/checkpath.pl

./scripts/checkpatch.pl --file --terse drivers/staging/comedi/drivers/ssv_dnp.c


No comments:

Post a Comment

vm - Centos - Boot into latest Kernel

sudo grub2-set-default 0 sudo grub2-mkconfig -o /boot/grub2/grub.cfg sudo reboot