[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [HS] Preprocessing



Le 12241ième jour après Epoch,
Yves Rutschle écrivait:

> On Tue, Jul 08, 2003 at 05:10:00PM +0200, François TOURDE wrote:
>> > #define TOTO 1
>> >
>> > (....)
>> >
>> > #if TOTO
>> >     reconfigure( toto );
>> > #endif
>> >
>> > tu écris:
>> >
>> > #define TOTO 1    (on peut toujours pas faire sans)
>> >
>> > (...)
>> >
>> >    if (TOTO)
>> >        reconfigure( toto );
>> >
>> 
>> Tu peux aussi dire:
>> 
>> [static] int TOTO=1;
>> 
>> if (TOTO)
>>   reconfigure(toto);
>
> Non, dans ce cas tu compiles effectivement le test et tu
> mets un appel à reconfigure(), car TOTO est une variable et
> le compilateur ne sait pas si quelqu'un d'autre dans un
> autre module ne va pas le changer.

Tout a fait, je m'a gourré :)

Je voulais écrire:

[static] const int TOTO=1;

mais je suis pas sûr que ça marche en C ... En tout cas, une constante
initialisée réponds parfaitement au concept du #define ...


-- 
Some men love truth so much that they seem to be in continual fear
lest she should catch a cold on overexposure.
		-- Samuel Butler
-- 
François TOURDE - tourde.org - 23 rue Bernard GANTE - 93250 VILLEMOMBLE
Tél: 01 49 35 96 69 - Mob: 06 81 01 81 80
eMail: mailto:francois@tourde.org - URL: http://francois.tourde.org/



Reply to: