※ 引述《[email protected] (10/100天自我觀察)》之銘言:
> 我有個問題,在C++的開發上請問.h檔要怎麼寫
> 以下我提供兩種STYLE
> ___________________________________________________________
> |STYLE(I) | STYLE(II) |
> |---------------------------+-------------------------------|
> |//file:xxx9.h | //new file:xxx9.h |
> |#ifndef _XXX9_H | class A; |
> |#define _XXX9_H | class B; |
> | class A{/*...*/}; | class C; |
> | class B{/*...*/}; | #ifndef _XXX9_H |
> | class C{/*...*/}; | #define _XXX9_H |
^^^^^^^^
另外補充一下,
慣例上遇到 #ifdef 之後的 code 不必縮排,
有些慣例是遇到 namespace 也是不必縮排的。
--
Name: Tseng, Ling-hua E-mail Address: [email protected]
School: National Tsing Hua University Department: Computer Science
Interesting: C++, Compiler, PL/PD, OS, VM, Large-scale software design
Researching: Software pipelining for VLIW architectures
Homepage: https://it.muds.net/~uranus
--
╔═══╗ ┼────────────────────────╮
║狂狷 ║ │* Origin:[ 狂 狷 年 少 ] whshs.cs.nccu.edu.tw ╰─╮
║ 年少║ ┼╮ < IP:140.119.164.252 > ╰─╮
╚╦═╦╝ ╰ * From:61-230-218-171.dynamic.hinet.net
─╨─╨─ KGBBS ─ ◎ 遨翔"BBS"的狂狷不馴;屬於年少的輕狂色彩 ◎