🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.lang.c
Article #15403

Re: champ de bits...

#15403
From: Yves ROMAN
Date: Mon, 26 Sep 2005 08:40
53 lines
1967 bytes
"Bouloun" <b@b.com> a �crit dans le message de news: 
433442ce$0$12992$7a628cd7@news.club-internet.fr...
> Bonjour
> J'ai un projet qui s'organise co �a:
>
> Main.C
> Appl.c
> Appl.h
>
>    Dans Main .C j'utilise un champ de bit du genre : (d�laration faite 
> juste apr�s les variables globales)
> struct
>   {
>    unsigned t1:1
>    unsigned t2:1
>    }cfg;
>
> Le probl�me c'est que le fichier Appl.c doit lui aussi pouvoir avaoir 
> acc�s � ce champ de bit.
>
> Comment faire pour pouvoir aussi utiliser ce champ de bit dans mon fichier 
> Appl.C ?
>

Par rapport aux autres, pour �viter d'avoir 2 d�clarations/d�finitions de 
cfg dans un .h et un .c , tu peux aussi faire

Dans Appl.h :

#ifdef DANS_MAIN
#define    VAR
#else
#define    VAR    extern
#endif

struct cfg
{
   unsigned t1:1
   unsigned t2:1
};

VAR struct cfg cfg;


Dans Appl.c :

#include Appl.h


Dans  Main.c :

#define    DANS_MAIN
#include Appl.h
Technical Details
Message-ID: <dh8c2u$1hn$1@s1.news.oleane.net>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!134.158.69.22.MISMATCH!in2p3.fr!oleane.net!oleane!not-for-mail
References: <433442ce$0$12992$7a628cd7@news.club-internet.fr>

Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,f57b8b7d4d821213
X-Google-Attributes: gidf9822,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!134.158.69.22.MISMATCH!in2p3.fr!oleane.net!oleane!not-for-mail
From: "Yves ROMAN" <yves.roman@NO.unilog.SPAM.fr>
Newsgroups: fr.comp.lang.c
Subject: Re: champ de bits...
Date: Mon, 26 Sep 2005 10:40:43 +0200
Organization: Guest of France Telecom's news reading service
Lines: 56
Message-ID: <dh8c2u$1hn$1@s1.news.oleane.net>
References: <433442ce$0$12992$7a628cd7@news.club-internet.fr>
NNTP-Posting-Host: cerbere.unilog.fr
X-Trace: s1.news.oleane.net 1127723935 1591 194.3.185.2 (26 Sep 2005 08:38:55 GMT)
X-Complaints-To: abuse@oleane.net
NNTP-Posting-Date: Mon, 26 Sep 2005 08:38:55 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response