[vlc-devel] [Request for Comment] new filter module for AtmoLight

Rémi Denis-Courmont rdenis at simphalempin.com
Sun Nov 25 11:53:10 CET 2007


Le Sunday 25 November 2007 12:05:31 Jean-Paul Saman, vous avez écrit :
> 5) write function pointers in structs as (it is much more readible and
> directly clear it is meant to be a function):

This is only true as far as they are many of them.

> struct mystruct
> {
> 	int (*pf_atmo_initialize) (void);
> 	void (*pf_atmo_finalize) (int);
> 	int (*pf_atmo_switch_effect) (int);
> 	int (*pf_atmo_set_live_source) (int);
> 	void (*pf_atmo_create_transfer_buffers) (int, int, int, int);
> 	uint8_t* (*pf_atmo_lock_transfer_buffer) (void);
> 	void (*pf_atmo_send_pixel_data) (void);
> }
>
> 6) Coding style:
> - we use i_width iso width

That's one big mistake. This has incited people into using "int" recklessly, 
when it should be something else. At a time when we cannot assume, 
e.g. "ssize_t" and "int" are the same (they aren't on amd64), these convetion 
is plain simply beyond its time.

> - in "C" files declare variables at the beginning of a code block (just
> proper software engineering)

Proper software engineering?

You declare variables when you need them. This limits the risk of erroneous 
variable "reuse", and is way more readable, as it avoids scrolling to find 
variables. It also helps the compiler know that a variable is not needed 
before it's declared, which can only help optimization.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20071125/26786188/attachment.sig>


More information about the vlc-devel mailing list