3 |
|
|
4 |
|
|
5 |
This is a short document describing the preferred coding style for the |
This is a short document describing the preferred coding style for the |
6 |
XviD core library. Coding style is very personal, and we won't |
Xvid core library. Coding style is very personal, and we won't |
7 |
_force_ our views on anybody. But if everybody who submits |
_force_ our views on anybody. But if everybody who submits |
8 |
patches/codes to the CVS respect this coding style, the whole source |
patches/codes to the CVS respect this coding style, the whole source |
9 |
would be easier to read/understand for all the others developers. |
would be easier to read/understand for all the others developers. |
18 |
|
|
19 |
In short, 8-char indents would have made things easier to read, and |
In short, 8-char indents would have made things easier to read, and |
20 |
would have the added benefit of warning you when you're nesting your |
would have the added benefit of warning you when you're nesting your |
21 |
functions too deep. But because of some parts of the XviD code source |
functions too deep. But because of some parts of the Xvid code source |
22 |
has to use lot of if/else/for statements together, we have chosen to |
has to use lot of if/else/for statements together, we have chosen to |
23 |
set the standard tab length to 4 characters. |
set the standard tab length to 4 characters. |
24 |
|
|
94 |
function that counts the number of active users, you should call that |
function that counts the number of active users, you should call that |
95 |
"count_active_users()" or similar, you should _not_ call it |
"count_active_users()" or similar, you should _not_ call it |
96 |
"cntusr()". Try not to use global variables as they break reentrancy |
"cntusr()". Try not to use global variables as they break reentrancy |
97 |
and XviD aims to be (in a long term) a threadable library. |
and Xvid aims to be (in a long term) a threadable library. |
98 |
|
|
99 |
|
|
100 |
Encoding the type of a function into the name (so-called Hungarian |
Encoding the type of a function into the name (so-called Hungarian |
140 |
and it gets confused. You know you're brilliant, but maybe you'd like |
and it gets confused. You know you're brilliant, but maybe you'd like |
141 |
to understand what you did 2 weeks from now. |
to understand what you did 2 weeks from now. |
142 |
|
|
143 |
NB : This chapter does not apply very well to some XviD parts, but |
NB : This chapter does not apply very well to some Xvid parts, but |
144 |
keep this "philosphy" in mind anyway. |
keep this "philosphy" in mind anyway. |
145 |
|
|
146 |
|
|
175 |
file: |
file: |
176 |
|
|
177 |
(defun xvid-c-mode () |
(defun xvid-c-mode () |
178 |
"C mode with adjusted defaults for use with the XviD Sources." |
"C mode with adjusted defaults for use with the Xvid Sources." |
179 |
(interactive) |
(interactive) |
180 |
(c-mode) |
(c-mode) |
181 |
(message "Loading xvid-c-mode") |
(message "Loading xvid-c-mode") |
227 |
|
|
228 |
Chapter 8: Reentrance |
Chapter 8: Reentrance |
229 |
|
|
230 |
Well, at the moment, XviD is not a reentrant library because during |
Well, at the moment, Xvid is not a reentrant library because during |
231 |
its development, some mistakes have been comited. But reentrance is a |
its development, some mistakes have been comited. But reentrance is a |
232 |
long term aim for this project so you should not write code which is |
long term aim for this project so you should not write code which is |
233 |
not reentrant. |
not reentrant. |
254 |
64bit on 64 bit CPUs (ultra sparc, AMD hammer, Intel Itanium, Motorola |
64bit on 64 bit CPUs (ultra sparc, AMD hammer, Intel Itanium, Motorola |
255 |
powerpc64) |
powerpc64) |
256 |
|
|
257 |
But don't forget that the minimum platform targeted by the XviD |
But don't forget that the minimum platform targeted by the Xvid |
258 |
library is a 32bit cpu. So a 'int' should (never say 'is' in such a |
library is a 32bit cpu. So a 'int' should (never say 'is' in such a |
259 |
case) always be 32bit long (or bigger) |
case) always be 32bit long (or bigger) |
260 |
|
|
279 |
- *BSD (same archs as GNU/Linux) |
- *BSD (same archs as GNU/Linux) |
280 |
- Solaris. |
- Solaris. |
281 |
|
|
282 |
Last edited: $Date: 2004-03-22 22:36:23 $ |
Last edited: $Date: 2010-12-22 16:52:52 $ |