[FFmpeg-devel] _t POSIX namespace issues

Dave Dodge dododge
Fri Dec 12 03:02:42 CET 2008


On Thu, Dec 11, 2008 at 09:27:44PM +0000, Luca Abeni wrote:
> I like the "struct" keyword reminding me that something is a 
> structure,

Aside: the Linux kernel tends to avoid typedefs for this reason,
especially typedefs of aggregates where the members will be accessed
directly.  They prefer for structs to be immediately recognizable as
such.  It's been documented practice since at least 2002.

Their current CodingStyle has a big list of exceptions where typedefs
are still used.  I know one example is pte_t, which is usually a
single integer wrapped in a struct.  A feature of this is that it can
still be passed by value efficiently, but the compiler will complain
if you try to pass some _other_ type of integer when a pte_t is
expected.  I've used this technique in one of my own projects where
"block offset" and "byte offset" values were being handled at the same
time, and I wanted the complier to warn me if I accidentally passed
one where the other was needed.

                                                  -Dave Dodge




More information about the ffmpeg-devel mailing list