[MPlayer-dev-eng] Exporting functions and types
savignien at caramail.com
Thu Sep 25 11:02:32 CEST 2003
Apparently you don't mind doing the same thing twice...
I prefer that things be declared in only one file, even if it's not
written in the K&R.
But if you have another way to achieve it, let me know.
------- Message d'origine -------
De: D Richard Felker III <dalias at aerifal.cx>
Date: Wed, 24 Sep 2003 12:35:43 -0400
Sujet: Re: Re: [MPlayer-dev-eng] Exporting functions and types
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
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.
MPlayer-dev-eng mailing list
MPlayer-dev-eng at mplayerhq.hu
Pour gagner une Playstation 2, envoyez un SMS avec le code PS au 61321 (0,35 euro hors coût du SMS).
More information about the MPlayer-dev-eng