[MPlayer-dev-eng] Exporting functions and types

D Richard Felker III dalias at aerifal.cx
Wed Sep 24 18:35:43 CEST 2003


On Wed, Sep 24, 2003 at 10:05:40AM +0100, savignien hercule  wrote:
> 1. Sorry for the html...
> 2. extern is not "useless". It's the default class for functions. That's why
> you don't need to use it explicitly.

Thus the keyword is useless.

> My goal with the "hack" I propose is :
> - Be clear about the types and functions wich are exported : they are in the .h file
> and nowhere else.
> - Declare things only once so if you modify them you do the job one time.
> 
> Note that my "hack", as you call it, works also for global variables, so if only for that
> it may be a good idea no ?

NO, IT IS NOT A GOOD IDEA, AND IT IS NOT NEEDED FOR GLOBAL VARS
EITHER!!!

Put "int foo;" in foo.c and "extern int foo;" in foo.h. No need for
hideous preprocessor crap. And the compiler will tell you if the types
mismatch (in case they change at some point).

Again, all of your proposals show a severe lack of understanding of C.
Go read K&R or something.

Rich




More information about the MPlayer-dev-eng mailing list