Article View: fr.comp.lang.c
Article #15505Re: champ de bits...
From: Pierre Habouzit
Date: Fri, 23 Sep 2005 18:16
Date: Fri, 23 Sep 2005 18:16
50 lines
2199 bytes
2199 bytes
Bouloun wrote:
> 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 ?
d�j� c'est bizare de mettre des majuscules dans les noms de fichiers, mais
c'est sans doute un d�tail.
Ensuite, pour partager des d�finitions de type il faut les mettre dans des
fichier .h (headers) que tu #include dans tes .h
Enfin, ton code ne me parait pas correct, il faudrait plutot �crire :
struct cfg {
unsigned int t1:1;
unsigned int t2:1;
};
ou bien :
typedef struct {
unsigned int t1:1;
unsigned int t2:1;
} cfg;
� mettre dans un cfg.h par exemple.
--
�O� Pierre Habouzit
��O madcoder@debian.org
OOO http://www.madism.org
Technical Details
Message-ID:
<4334462d$0$24227$626a14ce@news.free.fr>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!infeed-1.proxad.net!news18-e.free.fr!not-for-mailReferences:
<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!infeed-1.proxad.net!news18-e.free.fr!not-for-mail
Message-ID: <4334462d$0$24227$626a14ce@news.free.fr>
From: Pierre Habouzit <madcoder@debian.org>
Subject: Re: champ de bits...
Newsgroups: fr.comp.lang.c
Date: Fri, 23 Sep 2005 20:16:44 +0200
References: <433442ce$0$12992$7a628cd7@news.club-internet.fr>
User-Agent: KNode/0.9.2
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 8Bit
X-Face: $(^e[V4D-[`f2EmMGz@fgWK!e.B~2g.{08lKPU(nc1J~z\4B>*JEVq:E]7G-\6$Ycr4<;Z!|VY6Grt]+RsS$IMV)f>2)M="tY:ZPcU;&%it2D81X^kNya0=L]"vZmLP+UmKhgq+u*\.dJ8G!N&=EvlD
Lines: 50
Organization: Guest of ProXad - France
NNTP-Posting-Date: 23 Sep 2005 20:15:09 MEST
NNTP-Posting-Host: 82.225.205.10
X-Trace: 1127499309 news18-e.free.fr 24227 82.225.205.10:54574
X-Complaints-To: abuse@proxad.net