Changes between Version 12 and Version 13 of Hacking


Ignore:
Timestamp:
02/15/11 21:51:25 (14 years ago)
Author:
angel_il
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Hacking

    v12 v13  
    225225}}} 
    226226 
    227 typical structure of *.c file 
     227=== Headers === 
     228 
     229Do not mix headers 
     230 
     231'''This is right:''' 
     232{{{ 
     233 
     234#include <errno.h> 
     235#include <stdio.h> 
     236#include <string.h> 
     237 
     238#include <sys/types.h> 
     239#include <sys/stat.h> 
     240 
     241#include "lib/global.h" 
     242#include "lib/tty/tty.h"        /* LINES, tty_touch_screen() */ 
     243#include "lib/tty/win.h"        /* do_enter_ca_mode() */ 
     244 
     245#include "src/subshell.h"       /* use_subshell */ 
     246#include "src/help.h"           /* interactive_display() */ 
     247#include "src/setup.h" 
     248 
     249}}} 
     250 
     251'''This is wrong:''' 
     252{{{ 
     253#include <errno.h> 
     254#include <sys/types.h> 
     255#include <stdio.h> 
     256#include <string.h> 
     257 
     258#include <sys/stat.h> 
     259 
     260#include "src/subshell.h"       /* use_subshell */ 
     261#include "src/help.h"           /* interactive_display() */ 
     262 
     263#include "lib/tty/tty.h"        /* LINES, tty_touch_screen() */ 
     264#include "lib/tty/win.h"        /* do_enter_ca_mode() */ 
     265 
     266#include "src/setup.h" 
     267#include "lib/global.h" 
     268 
     269}}} 
     270 
     271Use short comment for header file 
     272 
     273'''This is right:''' 
     274{{{ 
     275#include "lib/tty/tty.h"        /* LINES, tty_touch_screen() */ 
     276#include "lib/tty/win.h"        /* do_enter_ca_mode() */ 
     277#include "src/subshell.h"       /* use_subshell */ 
     278#include "src/help.h"           /* interactive_display() */ 
     279 
     280}}} 
     281 
     282Do not mix global and local variables and functions. 
     283Do not mix static and non-static statments. 
     284 
     285Follow typical structure of *.c file: 
    228286 
    229287{{{